-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBEdit.qml
More file actions
40 lines (39 loc) · 1.1 KB
/
BEdit.qml
File metadata and controls
40 lines (39 loc) · 1.1 KB
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
import QtQuick 2.12
import QtQuick.Controls 2.12
Item{
id: root
implicitHeight: row.height
implicitWidth: row.width
property string label: ''
property string stringvalue: '\t'
property string defaultvalue: ''
property bool persistent: false
property bool enabled: true
property int fieldwidth: 150
property bool numberfield: false
signal reset()
signal setvalue(string s)
onSetvalue: control.text=s
onReset: if(!persistent) control.text=defaultvalue
DoubleValidator{
id: dv
notation: DoubleValidator.StandardNotation
}
Row{
id: row
spacing: 10
Label{
text: root.label
anchors.verticalCenter: parent.verticalCenter
}
TextField{
id: control
enabled: root.enabled
width: root.fieldwidth
onTextChanged: root.stringvalue=text+'\t'
Keys.onReturnPressed: focus = false
inputMethodHints: root.numberfield ? Qt.ImhFormattedNumbersOnly:Qt.ImhNone
validator: root.numberfield ? dv : null
}
}
}