- In my application i am using navigation pane. and i want to make separate files for every QML Let suppose this is my file
applicationui.cpp
// initial load
// Create scene document from main.qml asset, the parent is set
// to ensure the document gets destroyed properly at shut down.
QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
// Create root object for the UI
AbstractPane *root = qml->createRootObject<AbstractPane>();
// Set created root object as the application scene
app->setScene(root);
2.Here i am loading main.qml which is like this
import bb.cascades 1.0
NavigationPane {
id: navigationPane
Page {
titleBar: TitleBar {
// Localized text with the dynamic translation and locale updates support
title: qsTr("Page 1") + Retranslate.onLocaleOrLanguageChanged
}
Container {
}
actions: ActionItem {
title: qsTr("Second page") + Retranslate.onLocaleOrLanguageChanged
ActionBar.placement: ActionBarPlacement.OnBar
onTriggered: {
// A second Page is created and pushed when this action is triggered.
navigationPane.push(secondPageDefinition.createObject());
}
}
}
attachedObjects: [
// Definition of the second Page, used to dynamically create the Page above.
ComponentDefinition {
id: secondPageDefinition
source: "DetailsPage.qml"
}
]
onPopTransitionEnded: {
// Destroy the popped Page once the back transition has ended.
page.destroy();
}
}
3.And in this file I am calling "DetailsPage.qml" file which look like this
import bb.cascades 1.0
Page {
titleBar: TitleBar {
// Localized text with the dynamic translation and locale updates support
title: qsTr("Second Page") + Retranslate.onLocaleOrLanguageChanged
}
Container {
Label {
id: msgLabel
objectName: "msgLabel"
}
}
}
step 1: how to create seperate .cpp and .hh file for DetailsPage.qml
step 2: I want this becasue i am doing networking operations in .cpp and .hh and designing in QML.
step 3: The main reason i am confuse here is if i navigate from QML then total control is with QML and vice versa. On stack first qml can recognize its c++ file but if stack increases then how we should do that.
-------Please let me know If you don't understand my problem----------------
Get sample app from my github samples for your query....
https://github.com/svmrajesh/BB-10-Cascades/tree/master/MY%20APPS/stackNavigation
See following post to get solution
what is this control and how to use it in BB 10 cascades for navigation