If you create QML file with Uppercase name like Page1.qml and Page2.qml
In you app you just load some another main.qml that may contain one of next tips:
1. the most simple is:
Code:
Item {
Page1 { //this line creates item from Page1.qml
id:page1
visible: true
...
}
...
Page2 { //this line creates item from Page2.qml
id:page2
visible: false
...
}
}
and in Page1.qml and Page2.qml you have some button that changes visibility of your page like this:
Code:
onClicked: {
page1.visible = false;
page2.visible = true;
}
2. More difficult method is using loader:
main.qml will contain only Loader component:
Code:
Loader {
id:someLoader
source: "path/to/Page1.qml"
}
and again in Page1.qml and Page2.qml you have some button that changes loader source
Code:
onClicked: {
someLoader.source= "path/to/Page2.qml"
}
Loader variant is perfect for menu based navigation.
My English is worse, so if something is not clear please ask.)