c++ - BB Cascades, Passing data from C to Page1.qml and also to Page2.qml -
i know little thing missing here, have spent amout our hours trying figure out. objective-c background , trying this:
i have main.qml navigationpane , has 2 other external pages added attached object. 2 pages have grid list views. now, there myapp.cpp file loads json file , populates result in main.qml file. display relevalt items on page @ first. when user taps on item, want take them page2.qml has grid list view mentioned above , populate datamodel passed main.qml (which has info myapp.cpp). has give me no joy @ all! need help. can create work? please need help on one...
i'm not sure if best practice or not, easiest method found utilize qt global object.
basically assign either info or object qt object , can access other page.
e.g. in main.qml in oncreationcompleted or whatever function receive info in:
function getdata(data) { qt.myvariable = data; }
then in other page(s) can access it. e.g. in page2.qml:
page { oncreationcomplete: { mylabel.text = qt.myvariable; } }
as mentioned, works objects well, can assign navigation pane, sheet, page, etc. things "qt.mynavpane.push(page)" becomes possible.
i encountered issues needed utilize qt various purposes. signals , slots improve practice think, not practical.
c++ qml blackberry-10 blackberry-cascades
No comments:
Post a Comment