-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMyRadioButtonInputItem.qml
63 lines (55 loc) · 1.77 KB
/
MyRadioButtonInputItem.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
import QtQuick
import QtQuick.Controls 2.15
import QtQuick 2.15
import QtQuick.Window 2.15
Item {
id: radioButtonInputItem
property alias checkedState: radioButton.checked
property bool visibleState: true
property alias textInput: inputButton.text
property alias methodHints: inputButton.inputMethodHints
property int textFieldHeight: 35
property int textFieldWidth: 80
property int leftMargin: 10
property int textSize: 20
property string textButton: ""
property RegularExpressionValidator inputValidator: RegularExpressionValidator { regularExpression: /[0-9.,]+/ }
signal clicked()
RadioButton {
id: radioButton
anchors {
top: parent.top
topMargin: -radioButtonInputItem.textFieldHeight / 2
left: parent.left
leftMargin: radioButtonInputItem.leftMargin
}
text: radioButtonInputItem.textButton
font.pointSize: radioButtonInputItem.textSize
visible: radioButtonInputItem.visibleState
onClicked: {
inputButton.text = ""
radioButtonInputItem.clicked()
}
}
TextField {
id: inputButton
anchors {
bottom: parent.bottom
horizontalCenter: parent.horizontalCenter
}
width: parent.width - 20
height: radioButtonInputItem.textFieldHeight
visible: radioButtonInputItem.visibleState
validator: radioButtonInputItem.inputValidator
text: radioButtonInputItem.textInput
background: Rectangle {
border.color: "black"
border.width: 2
radius: 10
}
readOnly: radioButton.checked
//TODO
Keys.onReturnPressed: calculate()
Keys.onTabPressed: calculate()
}
}