-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBSlider.qml
37 lines (36 loc) · 954 Bytes
/
BSlider.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
import QtQuick 2.12
import QtQuick.Controls 2.12
Item{
id: root
implicitHeight: row.height
implicitWidth: row.width
property string label: ''
property int maxvalue: 5
property string stringvalue: '0\t'
property int defaultvalue: 0
property int value: defaultvalue
property bool enabled: true
property int fieldwidth: 150
property bool persistent: false
signal reset()
onReset: if(!persistent) control.value=defaultvalue
Row{
id: row
Label{
text: root.label
anchors.verticalCenter: parent.verticalCenter
}
Slider{
id: control
to: root.maxvalue
value: root.value
width: root.fieldwidth
enabled: root.enabled
stepSize: 1
onValueChanged: {
root.value=value;
root.stringvalue=value.toString()+'\t'
}
}
}
}