c++ - How to load a second .qml file in BB 10 cascade -


what want is, button (in one.qml) click load separate .cpp file (second.cpp) , in .cpp file, call second.qml file. how can using bb10 c++ coding. not using qml coding. have done qml coding not want.

if compare android development, 1 activity call second activity has separate .xml file. that's exact thing want test here in bb10.

to load new qml document c++, have use that:

bb::cascades::qmldocument *qml = bb::cascades::qmldocument::create("asset:///yoursecondfile.qml"); // can define properties page qml->setcontextproperty("_propertyname", yourobject); bb::cascades::page *secondpage = qml->createrootobject();

see qmldocument documentation complete explanation of can document.

so, now, have page (or other component). you'll need push it, example, on navigationpane. can way:

// create button bb::cascades::actionitem* backaction = bb::cascades::actionitem::create()     .title(tr("previous page"))     .imagesource(qurl("asset:///back.png"))     .ontriggered(navigationpane, slot(pop()) );  // push page navigationpane->push(page     .paneproperties(bb::cascades::navigationpaneproperties::create()         .backbutton(backaction)     ) );

Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -