-
Notifications
You must be signed in to change notification settings - Fork 0
/
MotorZ.qml
86 lines (72 loc) · 2.09 KB
/
MotorZ.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
import QtQuick 2.5
import QtQuick.Controls 1.4
Rectangle{
Connections {
target: BLE
onMotorIgnore: {motorIgnore = true;}
onZAxisMinReached: {motorIgnore = true; zSlider.value = zSlider.minimumValue; motorIgnore = false}
onZAxisMaxReached: {motorIgnore = true; zSlider.value = zSlider.maximumValue; motorIgnore = false}
onStageIsReset: {motorIgnore = false;}
}
id: zAxis
property alias value: zSlider.value
property alias minValue: zSlider.minimumValue
property alias maxValue: zSlider.maximumValue
property alias step: zSlider.stepSize
property bool motorIgnore: false
width: 50
height: 192
anchors.right: yAxis.left
anchors.rightMargin: 15
anchors.verticalCenter: parent.verticalCenter
Slider {
id: zSlider
anchors.fill: parent
x: 390
y: 98
value: 0
maximumValue: 40
stepSize: 1
updateValueWhileDragging: false
orientation: Qt.Vertical
onValueChanged: {
textZ.text = value;
if (!zAxis.motorIgnore)
BLE.setZ(value);
}
}
Label {
id: zLabel
x: 33
y: 180
text: qsTr("Z")
anchors.horizontalCenter: zSlider.horizontalCenter
anchors.bottom: zSlider.top
anchors.bottomMargin: 0
font.bold: true
font.pointSize: 11
}
Rectangle {
width: 50
height: 20
border.color: "black"
border.width: 1
anchors.right: zSlider.right
anchors.rightMargin: 0
anchors.left: zSlider.left
anchors.leftMargin: 0
anchors.top: zSlider.bottom
anchors.topMargin: 9
TextInput {
id: textZ
validator: IntValidator{bottom: zSlider.minimumValue; top: zSlider.maximumValue}
text: zSlider.value
//anchors.centerIn: parent
anchors.fill: parent
horizontalAlignment: TextInput.AlignHCenter
onAccepted: {
zSlider.value = Number(text);
}
}
}
}