11-15-2012 04:20 AM
I'm doing a calculator, the list of result (ListView) works ok when in main.qml, but I moved it to a new qml file.
I have used " navPane.deprecatedPushQmlByString("page2.qml") " in NavigationPane but nothing happen when press the button.
Anyone know how to fix this, and please tell me how to open a new screen to show the detail of result in ListView.
Best Regards.
Sorry for bad english.
11-15-2012 04:44 AM
11-15-2012 01:24 PM
You would do something like the following (using a button in my sample code but should be the same for a a touch event in a list):
Button {
id: buttonID
onClicked: {
var blogpage = goToWebView.createObject();
navigationPane.push(blogpage);
}
attachedObjects: ComponentDefinition {
id: goToWebView
source: "blog.qml"
}
Where when you push the button, it pushes you to "blog.qml". Also note that my variable and id names (blogpage and goToWebView) can be whatever you want, just make sure it follows that same format as above.
11-15-2012 10:49 PM
It works but the blog.qml is a normal page, I try to make it to NavigationPane to push to another QML but It doesn't work.
This is my flow:
main.qml(NavigationPane) -> ListResult.qml(NavigationPane) -> DetailResult.qml(Page)
Thanks.
11-16-2012 11:25 AM
bcs925 is right. The code they posted can be copied to any page in your flow.
Check out the code in the base Navigation Pane when you create a new project.
Add the following to the DetailsPage.qml:
Button {
text: "More Details"
onClicked: {
// show detail page when the button is clicked
var page = getThirdPage();
console.debug("pushing details " + page)
navigationPane.push(page);
}
property Page thirdPage
function getThirdPage() {
if (! thirdPage) {
thirdPage = thirdPageDefinition.createObject();
}
return thirdPage;
}
attachedObjects: [
ComponentDefinition {
id: thirdPageDefinition
source: "MoreDetails.qml"
}
]
}
And add a new page MoreDetails.qml to be your 3rd level page on the navigation stack.