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
New Contributor
kongnb2k
Posts: 2
Registered: ‎11-12-2012
My Device: 9700

How to open new page in QMLcascade ?

I want to open new page in bb10, how I do it.

Regular Contributor
ametller
Posts: 54
Registered: ‎07-15-2010
My Device: Not Specified

Re: How to open new page in QMLcascade ?

[ Edited ]

You have two options if you want to use a NavigationPane, which is recommended:

 

1. Load it from the C++ code. To do so a good idea is to do something like the following in the function you would call to load another QML:

 

QmlDocument *qml = QmlDocument::create("asset:///anotherQML.qml");
qml->setContextProperty("appUi", this);
qml->setContextProperty("_navPane", m_navPane);

if (!qml->hasErrors()) {
	Page *appPage = qml->createRootObject<Page>();
	if (appPage) {
		m_navPane->push(appPage);
	}
}

 2. Load it directly from the QML:

 

// Navigation pane project template
import bb.cascades 1.0

NavigationPane {
    id: navigationPane
    Page {
        // page with a picture thumbnail
        Container {
            Button {
                id: testBtn
                text: "Load QML"
                onTriggered: {
                    navigationPane.push(asset:///anotherQML.qml);
                }
            }
        }
    }
}

 

New Contributor
kongnb2k
Posts: 2
Registered: ‎11-12-2012
My Device: 9700

Re: How to open new page in QMLcascade ?

how to open qml view from main qml  ues qml call c++ blackberry 10 

Developer
simon_hain
Posts: 16,354
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: How to open new page in QMLcascade ?

i don't understand your second question.
is the first issue resolved? please mark it as solved and open a new thread for a new question.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter