[SOLVED] How to share variables between different pages ?
-
I think you can store your data in a C++ object, make it accessible from your QML page, call a method on this object in your qml, and that method in your C++ code can load the data into the target QML page .... please consider QAbstractItemModel and have look at http://doc.qt.nokia.com/4.7/qdeclarativemodels.html for examples, cheers.
-
Hi,
add a property to your PageStack and than you can access this property from pages by using
@
pageName.pageStack.yourPropertyName
@ -
I suggest not to talk with other page directly because this introduces unwanted coupling with pages. Share the data using setter and getter methods via javascript. Make sure it is a defined with .pragma library so that this JS is always shared.
-
Hi,
thanks for your help !
I found this in the wiki (shame on me)
http://www.developer.nokia.com/Community/Wiki/Defining_global_variable_in_QML
I think this is what srikanthsombhatla means. The hard page coupling should be no problem for me, but I want to share a JS array. It looks easier for me to try the JS-lib-thing.
Thanks a lot !
Ciao
Matze