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. Loader Element
Forum Update on Monday, May 27th 2025

Loader Element

Scheduled Pinned Locked Moved QML and Qt Quick
8 Posts 3 Posters 3.9k Views
  • 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 Offline
    K Offline
    kyleplattner
    wrote on 26 Oct 2010, 16:47 last edited by
    #1

    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
    0
    • 2 Offline
      2 Offline
      2beers
      wrote on 26 Oct 2010, 17:49 last edited by
      #2

      "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
      0
      • K Offline
        K Offline
        kyleplattner
        wrote on 26 Oct 2010, 18:04 last edited by
        #3

        It would be great information to know.

        1 Reply Last reply
        0
        • 2 Offline
          2 Offline
          2beers
          wrote on 26 Oct 2010, 18:06 last edited by
          #4

          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
          0
          • K Offline
            K Offline
            kyleplattner
            wrote on 26 Oct 2010, 21:26 last edited by
            #5

            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
            0
            • 2 Offline
              2 Offline
              2beers
              wrote on 26 Oct 2010, 22:21 last edited by
              #6

              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
              0
              • M Offline
                M Offline
                mbrasser
                wrote on 27 Oct 2010, 00:56 last edited by
                #7

                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
                0
                • K Offline
                  K Offline
                  kyleplattner
                  wrote on 27 Oct 2010, 14:39 last edited by
                  #8

                  Thanks for the help.

                  1 Reply Last reply
                  0

                  1/8

                  26 Oct 2010, 16:47

                  • Login

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