PageStack.find and qml files pages [Solved]
-
Hi All,
I use PageStack.find function without issues when I search for a page in the stack which was originating from the main file.
But when a page is loaded from a separate file I seems to be missing the logic of what I should be doing to get proper response...@pageStack.push(Qt.resolvedUrl("content/Page1.qml"));
console.log(pageStack.find(function(id) { return id == "page1id" }))@So basically after I pushed Page1 to the stack I want to use find function to get to know if it is there.
What is the trick?Read the documentation and it is quite not getting clarity for me...
-
Hi,
I suppose that page1id is inside Page1.qml, so I think that it is not visible.
Edit: I found "this":http://doc.trolltech.com/4.8-snapshot/qdeclarativedocuments.html
"Each id value in a QML document must be unique within that document. They do not need to be unique across different documents as id values are resolved according to the document scope." -
Hmm what should I do then to use pageStack.find to find these separate QML files? any advice?
PS: thanks for expalining the reason though anyway!!
-
Based on "this example":http://doc.qt.nokia.com/qt-components-symbian-1.0/qml-pagestack.html#finding-a-page-in-the-stack I can suggest you to use some page identifiers. For example, add uid property to every PageN.qml.
@
pageStack.pop(pageStack.find(function(page) {
return page.uid == "uid you want";
}));
@ -
i will try that but how this uid will become visible as your previous post suggests this uid will also remain unseen for the pagestack?
-
All properties of items are visible, only id is not. So you need some property that has unique value in every page.
-
ahh got it. thanks a million. Solved