Update IconCheckBox

pull/19/head
reionwong 4 years ago
parent 5771c1e977
commit 8a8aa5f2e2

@ -31,7 +31,7 @@ Item {
property alias text: label.text property alias text: label.text
property bool checked: false property bool checked: false
property var iconSize: 104 property var iconSize: 106
signal clicked signal clicked
@ -43,12 +43,29 @@ Item {
ColumnLayout { ColumnLayout {
id: mainLayout id: mainLayout
anchors.fill: parent anchors.fill: parent
spacing: FishUI.Units.smallSpacing
Image { Rectangle {
id: icon id: _box
width: control.iconSize width: control.iconSize
height: width height: width
color: "transparent"
border.width: 3
border.color: control.checked ? FishUI.Theme.highlightColor : "transparent"
Behavior on border.color {
ColorAnimation {
duration: 125
easing.type: Easing.InOutCubic
}
}
radius: FishUI.Theme.bigRadius + control.iconSpacing
visible: true
Image {
id: icon
anchors.fill: parent
anchors.margins: FishUI.Units.smallSpacing
sourceSize: Qt.size(icon.width, icon.height) sourceSize: Qt.size(icon.width, icon.height)
opacity: 1 opacity: 1
@ -84,18 +101,14 @@ Item {
} }
} }
} }
}
Label { Label {
id: label id: label
color: control.checked ? FishUI.Theme.highlightColor : FishUI.Theme.textColor
visible: label.text visible: label.text
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
} }
RadioButton {
checkable: false
checked: control.checked
Layout.alignment: Qt.AlignHCenter
}
} }
Behavior on scale { Behavior on scale {

Loading…
Cancel
Save