Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Problems on using functions and saving to an offline storage
Qt 6.11 is out! See what's new in the release blog

Problems on using functions and saving to an offline storage

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 3 Posters 3.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jr_jags
    wrote on last edited by
    #1

    I using a lot of commands and functions on a single mousearea, but the problem is cant process them all, and when im trying to save a data when mousearea is clicked, and when i want to view the saved data, it resets to its original value,

    @MouseArea {
    id: ahome2status
    x: 4
    y: 549
    width: 99
    height: 75
    onClicked: {mainLoader.source = "status.qml";
    timer.restart();
    pimp.visible = false
    glass.visible = false
    ring.visible = false
    ginger.visible = false
    red.visible = false
    prince.visible = false
    leatherhatitem1.visible = false
    leafyitem1.visible = false
    goldmask.visible = false
    decrementTimer.restart()
    timer.stop();
    ahome2bath.visible = false
    ahome2feed.visible = false
    ahome2map.visible = false
    ahome2status.visible = false
    ahome2play.visible = false
    ahome2sleep.visible = false
    Storage.setSetting("setting", display.text)
    Storage.setSetting("setting2", display2.text)
    Storage.setSetting("setting3", display3.text)
    Storage.setSetting("setting4", display4.text)
    }
    }@

    here is one of my mousearea, i think Qt cant process all my functions in a single click,
    I have 7 mouseareas with the same number of functions in my QML, is it advisable to use a lot of functions in a single mousearea click, and Loading another QML with a loader element??

    I think myQt Creator is having a hard time reading all my codes, and my javascript file,
    Any solutions??

    1 Reply Last reply
    0
    • AlicemirrorA Offline
      AlicemirrorA Offline
      Alicemirror
      wrote on last edited by
      #2

      One first thing that keep me suspiciuos is the mainLoader.source = "status.qml" statement. Is possible that this is a event that moves the program in another way so that you never set all or part of the others?

      Afaik, a betterpractice is - if the order is not essential - to manage the directe assignations before and timers reset after.

      Then try with a console.log("...") statement after every step to see if really all the assignements, resets etc are processed.

      Enrico Miglino (aka Alicemirror)
      Balearic Dynamics
      Islas Baleares, Ibiza (Spain)
      www.balearicdynamics.com

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mlong
        wrote on last edited by
        #3

        Also, if you find yourself replicating a lot of the same code in multiple places, you may want to consider moving it to a Javascript function() that you can call from multiple places.

        Software Engineer
        My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

        1 Reply Last reply
        0
        • AlicemirrorA Offline
          AlicemirrorA Offline
          Alicemirror
          wrote on last edited by
          #4

          As a code is simple and readable, as it is simple to isolate the issues.

          Enrico Miglino (aka Alicemirror)
          Balearic Dynamics
          Islas Baleares, Ibiza (Spain)
          www.balearicdynamics.com

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jr_jags
            wrote on last edited by
            #5

            yup, the mainloader.source will move you to another qml, and at the same time i want to implement the other functions on my mousearea onclicked,

            I tried moving all these commands to a javascript function but still, i experienced crash on my simulator,

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved