-
Notifications
You must be signed in to change notification settings - Fork 0
/
BSpinBox.qml
37 lines (36 loc) · 922 Bytes
/
BSpinBox.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: 99
property string stringvalue: '0\t'
property int defaultvalue: 0
property int value: defaultvalue
property bool persistent: false
property bool autoincrement: false
signal reset()
onReset: {
if(autoincrement) control.value += 1
else if(!persistent) control.value=defaultvalue
}
Row{
id: row
spacing: 10
Label{
text: root.label
anchors.verticalCenter: parent.verticalCenter
}
SpinBox{
id: control
to: root.maxvalue
value: root.value
onValueChanged: {
root.value=value
root.stringvalue=value.toString()+'\t'
}
}
}
}