Loader Element
-
wrote on 26 Oct 2010, 16:47 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?
-
wrote on 26 Oct 2010, 17:49 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.
-
wrote on 26 Oct 2010, 18:04 last edited by
It would be great information to know.
-
wrote on 26 Oct 2010, 18:06 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 :)
-
wrote on 26 Oct 2010, 21:26 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?
-
wrote on 26 Oct 2010, 22:21 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. :) -
wrote on 27 Oct 2010, 00:56 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 -
wrote on 27 Oct 2010, 14:39 last edited by
Thanks for the help.
1/8