Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 206
Registered: ‎05-15-2012
My Device: None
My Carrier: Telus
Accepted Solution

Push a .qml page using a C++ defined Navigation pane.

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.

----------------------
Check out my app, Alien Flow for reddit

And of course, like my post if you found it helpful or informative!
Developer
Posts: 86
Registered: ‎05-21-2012
My Device: Blackberry 10 Dev Alpha
My Carrier: IDEA

Re: Push a .qml page using a C++ defined Navigation pane.

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").parent(this);
Page *new_page = qml->createRootObject<Page>();
nav_pane->push(new_page);
app->setScene(nav_pane);

 - Regards

   Raju

- Raju
Highlighted
Developer
Posts: 37
Registered: ‎09-04-2012
My Device: Blackberry 10 Dev Alpha
My Carrier: Vodafone Mumbai

Re: Push a .qml page using a C++ defined Navigation pane.

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. 

 

 

New Contributor
Posts: 8
Registered: ‎02-18-2013
My Device: 8700,9300,8520,Blackberry Z10
My Carrier: BB

Re: Push a .qml page using a C++ defined Navigation pane.

its working.. thank you..