feat(StatusColorRadioButton): expose radio button diameter property

Issue #5982
This commit is contained in:
Michal Iskierko 2022-07-12 10:31:48 +02:00 committed by Michał Iskierko
parent 737b9cfb3f
commit 5c24767310
2 changed files with 13 additions and 4 deletions

View File

@ -8,19 +8,21 @@ RadioButton {
property string radioButtonColor: "" property string radioButtonColor: ""
property string selectionColor: StatusColors.colors['white'] property string selectionColor: StatusColors.colors['white']
property int diameter: 48
property int selectorDiameter: 20
implicitWidth: 48 implicitWidth: 48
implicitHeight: 48 implicitHeight: 48
indicator: Rectangle { indicator: Rectangle {
implicitWidth: 48 implicitWidth: control.diameter
implicitHeight: 48 implicitHeight: control.diameter
radius: width/2 radius: width/2
color: radioButtonColor color: radioButtonColor
Rectangle { Rectangle {
width: 20 width: control.selectorDiameter
height: 20 height: control.selectorDiameter
radius: width/2 radius: width/2
color: selectionColor color: selectionColor
border.color: StatusColors.colors['grey3'] border.color: StatusColors.colors['grey3']

View File

@ -12,6 +12,9 @@ Column {
property alias title: title property alias title: title
property alias columns: grid.columns property alias columns: grid.columns
property int diameter: 48
property int selectorDiameter: 20
property int selectedColorIndex: 0 property int selectedColorIndex: 0
property string selectedColor: "" property string selectedColor: ""
property var model:[ StatusColors.colors['black'], property var model:[ StatusColors.colors['black'],
@ -46,6 +49,10 @@ Column {
Repeater { Repeater {
model: root.model model: root.model
delegate: StatusColorRadioButton { delegate: StatusColorRadioButton {
implicitWidth: root.diameter
implicitHeight: root.diameter
diameter: root.diameter
selectorDiameter: root.selectorDiameter
checked: index === selectedColorIndex checked: index === selectedColorIndex
radioButtonColor: root.model[index] || "transparent" radioButtonColor: root.model[index] || "transparent"
onCheckedChanged: { onCheckedChanged: {