-
Notifications
You must be signed in to change notification settings - Fork 12
/
Dashboard.qml
137 lines (115 loc) · 3.19 KB
/
Dashboard.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
import QtQuick 2.0
Item {
id: id_dashboard
//to creating data for demonstration purpose
property int count: 0
property int randNum: 0
Timer {
id: id_timer
repeat: true
interval: 1000
running: true
onTriggered: {
if(id_gear.value == 6) id_gear.value = 0;
else id_gear.value++;
if(count % 5 == 0){
if(id_speed.value == 0) id_speed.value = 280
else id_speed.value = 0
if(id_info.fuelValue == 0) id_info.fuelValue = 4
else id_info.fuelValue = 0
}
count++;
if(count % 2 == 0){
id_turnLeft.isActive = true
id_turnRight.isActive = false
}else{
id_turnLeft.isActive = false
id_turnRight.isActive = true
}
}
}
Rectangle {
id: id_speedArea
anchors {
horizontalCenter: parent.horizontalCenter
}
width: parent.width * 0.4
height: width
color: "black"
radius: width/2
z: 1
Speed {
id: id_speed
anchors.fill: id_speedArea
anchors.margins: id_speedArea.width * 0.025
}
}
Rectangle {
id: id_gearArea
anchors {
bottom: id_speedArea.bottom
}
x: parent.width / 20
width: parent.width * 0.35
height: width
color: "black"
radius: width/2
Gear {
id: id_gear
anchors.fill: id_gearArea
anchors.margins: id_gearArea.width * 0.025
}
}
Rectangle {
id: id_infoArea
anchors {
bottom: id_speedArea.bottom
}
x: parent.width - parent.width / 2.5
width: parent.width * 0.35
height: width
color: "black"
radius: width/2
Info {
id: id_info
anchors.fill: id_infoArea
anchors.margins: id_infoArea.width * 0.025
}
}
Rectangle {
anchors {
bottom: id_speedArea.bottom
left: id_gearArea.horizontalCenter
right: id_infoArea.horizontalCenter
}
height: id_gearArea.width / 2
color: "black"
z: -1
}
Turn {
id: id_turnLeft
anchors {
right: id_gearArea.right
rightMargin: id_gearArea.height * 0.04
bottom: id_gearArea.bottom
bottomMargin: id_gearArea.height * 0.01
}
width: id_gearArea.width / 5.5
height: id_gearArea.height / 8.2
isActive: false
}
Turn {
id: id_turnRight
anchors {
left: id_infoArea.left
leftMargin: id_infoArea.height * 0.04
bottom: id_infoArea.bottom
bottomMargin: id_infoArea.height * 0.01
}
width: id_infoArea.width / 5.5
height: id_infoArea.height / 8.2
transformOrigin: Item.Center
rotation: 180
isActive: true
}
}