11-19-2012 04:40 AM
If I have a navigation pane defined in C++ as such...
nav = qml->createRootObject<NavigationPane>();
How do I push a page called page.qml? The only documentation I can find involves building the page in C++, which I don't intend to do. The Page object doesn't seem to have a constructor that takes a Page qml file as input, so I'm not sure how to create a Page object from it, to push with NavigationPane->push(Page*) function.
Solved! Go to Solution.
11-19-2012 04:54 AM
First you need to load the qml file and create the page object from the qml. Then push the page into that navigation pane.
This code may help you!!!
NavigationPane *nav_pane = new NavigationPane; QmlDocument *qml = QmlDocument::create("asset:///MyListView.qml").par
ent(this); Page *new_page = qml->createRootObject<Page>(); nav_pane->push(new_page); app->setScene(nav_pane);
12-19-2012 02:21 AM
I have used the below code that works like a charm, but I want to access the UI components that are present in the Page object how to do that I am trying the below but the application crashes
I have a NavigationPane in c++ file and the below page is to be pushed after click of the button.
QmlDocument *qml = QmlDocument::create("asset:///SearchResults.qml").
parent(this); qml->setContextProperty("peoplefinder", this); Page *mypage = qml->createRootObject<Page>(); qml->setParent(mypage); ActivityIndicator *myindicator = qml->findChild<ActivityIndicator*>("myIndicator"); qDebug() << myindicator->isVisible(); mNavigator->push(mypage);
Please help me how to do this I have tried accessing the child ActivityIndicator via mypage object also but am unable to do so.