-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDialTemperature.qml
63 lines (59 loc) · 1.62 KB
/
DialTemperature.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
import QtQuick 2.7
import QtQuick.Controls 2.2
Dial {
id: control
property var label_text: null
background: Rectangle {
x: control.width / 2 - width / 2
y: control.height / 2 - height / 2
width: Math.max(64, Math.min(control.width, control.height))
height: width
color: "transparent"
radius: width / 2
border.color: control.pressed ? "#17a81a" : "#21be2b"
opacity: control.enabled ? 1 : 0.3
Label {
id: label
visible: control.label_text != null
text: control.label_text
font.pixelSize: 14
anchors.left: parent.left
anchors.right: parent.right
y: control.height / 2 - height
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignBottom
}
Text {
text: control.value.toFixed(1) + ' °C'
color: '#63be5f'
font.pixelSize: 26
anchors.top: label.visible ? label.bottom : parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
horizontalAlignment: Text.AlignHCenter
verticalAlignment: label.visible ? Text.AlignTop : Text.AlignVCenter
}
}
handle: Rectangle {
id: handleItem
x: control.background.x + control.background.width / 2 - width / 2
y: control.background.y + control.background.height / 2 - height / 2
width: 20
height: 20
color: control.pressed ? "#17a81a" : "#21be2b"
radius: 10
antialiasing: true
opacity: control.enabled ? 1 : 0.3
transform: [
Translate {
y: -Math.min(control.background.width, control.background.height) * 0.48 + handleItem.height / 2
},
Rotation {
angle: control.angle
origin.x: handleItem.width / 2
origin.y: handleItem.height / 2
}
]
}
}