Skip to content
Permalink
Browse files

[QgsQuick] Handle empty config for checkbox editor widget

Use true/false instead of un/checkedState if empty
  • Loading branch information
vsklencar authored and wonder-sk committed Apr 18, 2019
1 parent cb9b3b4 commit 5b7e67afecac4096a1dbb9093bce6eaebde19c3f
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/quickgui/plugin/editor/qgsquickcheckbox.qml
@@ -38,7 +38,7 @@ Item {
height: customStyle.fields.height
id: checkBox
leftPadding: 0
checked: value == config['CheckedState']
checked: config['CheckedState'] ? value == config['CheckedState'] : value

indicator: Rectangle {
implicitWidth: customStyle.fields.height
@@ -60,13 +60,14 @@ Item {
}
}
onCheckedChanged: {
valueChanged( checked ? config['CheckedState'] : config['UncheckedState'], false )
valueChanged( checked ? (config['CheckedState'] ? config['CheckedState'] : true) :
(config['UncheckedState'] ? config['UncheckedState'] : false), false )
forceActiveFocus()
}

// Workaround to get a signal when the value has changed
onCurrentValueChanged: {
checked = currentValue == config['CheckedState']
checked = config['CheckedState'] ? currentValue == config['CheckedState'] : currentValue
}
}
}

0 comments on commit 5b7e67a

Please sign in to comment.
You can’t perform that action at this time.