Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

How to make QML applications with multiple files using the same technique as is done with Qt and Widgets?

$
0
0
Hi, From a “basic” point of view, each QML file defines a type, and if that type happens to be a visual item with some set dimensions (say, 500×500pix) then you can simply instantiate each one, and set the visible property of each appropriately. //main.qml Item {     width: 500     height: 500       MyPageOne { // defined in MyPageOne.qml         id: p1         anchors.fill: parent         visible: true     }       MyPageTwo { // defined in MyPageTwo.qml         id: p2         anchors.fill: parent         visible: false     }       // then on some event like a button click or whatever...     function switchView() {         p1.visible: false         p2.visible: true     } } From a “higher level” point of view, most component sets / controls offer the “page stack” and “page” types. You define your types as Page-derived types, and then push/pop pages on/off the pagestack to perform UI navigation. There are plenty of examples on the web of this, since it was common in Harmattan for example. Cheers, Chris.

Viewing all articles
Browse latest Browse all 4972

Trending Articles