-
Notifications
You must be signed in to change notification settings - Fork 0
/
GuiRadioButton.qml
58 lines (51 loc) · 1.38 KB
/
GuiRadioButton.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
import QtQuick 2.12
import QtQuick.Controls 2.12
RadioButton {
id: control
property var group: null
property var name: text.toLowerCase()
property bool lastVisible: true
visible: true
text: qsTr("RadioButton")
checked: false
indicator: Rectangle {
implicitWidth: 15*k
implicitHeight: 15*k
x: control.leftPadding
y: parent.height / 2 - height / 2
radius: implicitHeight/2
Rectangle {
width: parent.implicitWidth/2
height: width
anchors.centerIn: parent
radius: width/2
color: control.down ? "#17a81a" : "black"
visible: control.checked
}
}
contentItem: Text {
text: control.text
opacity: enabled ? 1.0 : 0.3
color: "white"
verticalAlignment: Text.AlignVCenter
leftPadding: control.indicator.width + control.spacing
font.family: "Helvetica"
font.pixelSize: 16*k
font.bold: true
style: Text.Outline
styleColor: "black"
}
onCheckedChanged: {
if (checked && group !== null)
group.selected = name
}
onVisibleChanged: {
if(lastVisible !== visible){
if (visible)
parent.objectLength+=1
else
parent.objectLength-=1
}
lastVisible = visible
}
}