-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexercise_2.qml
70 lines (55 loc) · 1.6 KB
/
exercise_2.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
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.12
ApplicationWindow {
readonly property real target: targetController.value.toFixed(2)
readonly property real actual: actualController.value.toFixed(2)
title: qsTr("QML Course")
width: 640
height: 480
visible: true
Rectangle {
id: mainView
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
height: 0.8 * parent.height
anchors.margins: 10
border.width: 1
Label {
anchors.centerIn: parent
text: " target: " + target + " actual: " + actual
}
}
RowLayout {
anchors.top: mainView.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: 10
spacing: 10
SlideController {
id: targetController
Layout.fillWidth: true
text: "target"
from: 0
to: 359.99
}
SlideController {
Layout.fillWidth: true
id: actualController
text: "actual"
from: 0
to: 359.99
}
}
component SlideController: RowLayout {
property alias text: label.text
property alias value: slider.value
property alias from: slider.from
property alias to: slider.to
spacing: 5
Label { id: label; verticalAlignment: Label.AlignVCenter; height: slider.height }
Slider { id: slider; Layout.fillWidth: true; value: from }
}
}