QML Connecting two or more QML files
-
Hello, I'm new to QML start a week before, now I have a problem, with connection between many QML files, Best way to explane it is, imagine the week of the day, every day is in another file. And i have a navigation arrows at top,
Im trying to swipe from monday till sunday and back if i want, i hope you got what i mean, and i will really be greathfull if someone who is more familiar help me, Thank you for your time, have a nice day -
Go to Qt Assistant and look for QML Tutorial 2 - QML Components. This will surely help you.
It is similar to the following.
@
// Main.QML
Rectangle {
id : topWeek {
id : week}
MouseArea {
}
}}
@/ -
If I were you, I would have a look to "ListView" to easily have a swipe (see orientation to have a vertical view).
Set the property model to 7.
Now, use Loader to choose the correct Qml component according to the index.
It should be something like this :
@ListView {
Component {
id: dayLoader;
Loader {
source: {
if(index==0) return "MondayView.qml";
if(index==1) return "TuesdayView.qml";
...
}
}
model : 7;
delegate : dayLoader;
}@I hope it helps...