Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Loader Element

    QML and Qt Quick
    3
    8
    3470
    Loading More Posts
    • 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.
    • K
      kyleplattner last edited by

      When using a loader element to navigate to a new page is the page that has the loader event on it still loaded? In other words, if I just keep doing loader events to navigate from page to page will I run into memory issues eventually?

      1 Reply Last reply Reply Quote 0
      • 2
        2beers last edited by

        "To unload the currently loaded item, set this property to an empty string, or set sourceComponent to undefined."

        see more info here: "Loader":http://doc.qt.nokia.com/4.7/qml-loader.html#source-prop

        Not sure if you change the source to a different qml file, if it unloads the previous item. maybe someone from nokia stuff can answer that.

        1 Reply Last reply Reply Quote 0
        • K
          kyleplattner last edited by

          It would be great information to know.

          1 Reply Last reply Reply Quote 0
          • 2
            2beers last edited by

            I think it will unload the current qml item, but the best way to test it is to make a script to load 1000 times a qml file and see if there are any memory changes :)

            1 Reply Last reply Reply Quote 0
            • K
              kyleplattner last edited by

              I found that it does introduce memory problems. If anyone knows of an unload that would be the preferable way to fix it. Otherwise, would this be better:

              @Connections {
                      target: myLoader.item
                      onMessage: console.log(msg)
                  }@

              with the changePage() call?

              1 Reply Last reply Reply Quote 0
              • 2
                2beers last edited by

                Are you sure? because I did a test myself and didn't find any memory problem. however to unload a page just use this

                myLoader.source=""

                read more on the source property on Loader page.
                I think that if you change the source page it will do just fine. :)

                1 Reply Last reply Reply Quote 0
                • M
                  mbrasser last edited by

                  Setting the source to a new url will cause the item created by the previous url to be deleted (it uses deleteLater(), so it's possible that if you did this in a loop, you would see memory increase until the event loop was entered again).

                  I've updated the docs to clarify this.

                  Regards,
                  Michael

                  1 Reply Last reply Reply Quote 0
                  • K
                    kyleplattner last edited by

                    Thanks for the help.

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post