Skip to content

Commit 5b7e67a

Browse files
vsklencarwonder-sk
vsklencar
authored andcommitted
[QgsQuick] Handle empty config for checkbox editor widget
Use true/false instead of un/checkedState if empty
1 parent cb9b3b4 commit 5b7e67a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/quickgui/plugin/editor/qgsquickcheckbox.qml

+4-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Item {
3838
height: customStyle.fields.height
3939
id: checkBox
4040
leftPadding: 0
41-
checked: value == config['CheckedState']
41+
checked: config['CheckedState'] ? value == config['CheckedState'] : value
4242

4343
indicator: Rectangle {
4444
implicitWidth: customStyle.fields.height
@@ -60,13 +60,14 @@ Item {
6060
}
6161
}
6262
onCheckedChanged: {
63-
valueChanged( checked ? config['CheckedState'] : config['UncheckedState'], false )
63+
valueChanged( checked ? (config['CheckedState'] ? config['CheckedState'] : true) :
64+
(config['UncheckedState'] ? config['UncheckedState'] : false), false )
6465
forceActiveFocus()
6566
}
6667

6768
// Workaround to get a signal when the value has changed
6869
onCurrentValueChanged: {
69-
checked = currentValue == config['CheckedState']
70+
checked = config['CheckedState'] ? currentValue == config['CheckedState'] : currentValue
7071
}
7172
}
7273
}

0 commit comments

Comments
 (0)