-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCruise.qml
76 lines (55 loc) · 1.38 KB
/
Cruise.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
import QtQuick 2.11
import QtGraphicalEffects 1.0
Item {
id: cruise
property real speed: 100
property real battery: 0.5
width: 200
height: 200
Text {
id: speed_txt
anchors.horizontalCenter: cruise.horizontalCenter
anchors.top: cruise.top
anchors.topMargin: 8
text: Math.ceil(speed)
font.pointSize: 60
font.bold: true
color: "white"
}
Text {
id: measure
anchors.top: speed_txt.bottom
anchors.horizontalCenter: cruise.horizontalCenter
text: "Km/h"
color: "darkgrey"
}
Rectangle {
id: filler
anchors.fill: battery_mask
color: "black"
visible: false
Rectangle {
anchors.left: filler.left
color: (battery > 0.2) ? "#ff00ff00" : "#ffff0000"
height: filler.height
width: cruise.battery * parent.width
}
Image {
anchors.fill: parent
source: "images/batteria_vuota.png"
}
}
Image {
id: battery_mask
anchors.horizontalCenter: cruise.horizontalCenter
anchors.top: measure.bottom
anchors.topMargin: 20
source: "images/batteria_maschera.png"
visible: false
}
OpacityMask {
anchors.fill: filler
source: filler
maskSource: battery_mask
}
}