-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.qml
90 lines (89 loc) · 2.53 KB
/
main.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import QtQuick 2.10
import QtQuick.Window 2.3
import QtQuick.Controls 2.4
import QtQuick.Layouts 1.0
ApplicationWindow {
id: window
objectName: "window"
visible: stateController.state !== "loading"
width: screenGeometry.width
height: screenGeometry.height
title: Qt.application.displayName
Component.onCompleted: {
controller.startup();
}
header: Rectangle {
color: "black"
height: menu.height
RowLayout {
id: menu
anchors.left: parent.left
anchors.right: parent.right
Label {
text: "⬅️"
color: "white"
topPadding: 5
bottomPadding: 5
leftPadding: 10
rightPadding: 10
MouseArea {
anchors.fill: parent
onClicked: {
console.log("Back button pressed");
if(stateController.state === "loaded"){
console.log("Quitting");
Qt.quit();
return;
}
console.log("Going back to main view");
stateController.state = "loaded";
}
}
}
Item { Layout.fillWidth: true }
Label {
color: "white"
text: window.title
}
Item { Layout.fillWidth: true }
}
}
contentData: [
Rectangle {
anchors.fill: parent
color: "white"
Text {
anchors.centerIn: parent
text: "Hello World!"
}
}
]
StateGroup {
id: stateController
objectName: "stateController"
state: "loading"
states: [
State { name: "loaded" },
State { name: "loading" }
]
transitions: [
Transition {
from: "*"; to: "loaded"
SequentialAnimation {
ScriptAction { script: {
console.log("Display loaded");
} }
}
},
Transition {
from: "*"; to: "loading"
SequentialAnimation {
ScriptAction { script: {
console.log("Loading display");
controller.startup();
} }
}
}
]
}
}