To load a new QML document from C++, you have to use something like that:
bb::cascades::QmlDocument *qml = bb::cascades::QmlDocument::create("asset:///yourSecondFile.qml");
// You can define properties for your page
qml->setContextProperty("_propertyName", yourObject);
bb::cascades::Page *secondPage = qml->createRootObject();
See the QmlDocument
documentation for a complete explanation of what you can do with your document.
So, now, you have your Page
(or any other component). You'll need to push it, for example, on a NavigationPane
. You can do this that way:
// Create a back button
bb::cascades::ActionItem* backAction = bb::cascades::ActionItem::create()
.title(tr("Previous page"))
.imageSource(QUrl("asset:///back.png"))
.onTriggered(navigationPane, SLOT(pop())
);
// Push the page
navigationPane->push(page
.paneProperties(bb::cascades::NavigationPaneProperties::create()
.backButton(backAction)
)
);