From 82d4897ba4e24ba9e1ed52a9d79dff0fc88e0096 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 30 Nov 2018 16:18:46 +0100 Subject: [PATCH] Use MouseArea to catch click instead of onClicked This is necessary because when you click it, the 'checked' property no longer depends on the active extruder. So prevent it from being clicked at all and handle the click separately in this MouseArea. Contributes to issue CURA-5876. --- .../Menus/ConfigurationMenu/CustomConfiguration.qml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 605d0444e6..08ba042948 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -136,9 +136,19 @@ Item OldControls.CheckBox { checked: Cura.MachineManager.activeStack != null ? Cura.MachineManager.activeStack.isEnabled : false - onClicked: Cura.MachineManager.setExtruderEnabled(selectors.model.index, checked) height: UM.Theme.getSize("setting_control").height style: UM.Theme.styles.checkbox + + /* Use a MouseArea to process the click on this checkbox. + This is necessary because actually clicking the checkbox + causes the "checked" property to be overwritten. After + it's been overwritten, the original link that made it + depend on the active extruder stack is broken. */ + MouseArea + { + anchors.fill: parent + onClicked: Cura.MachineManager.setExtruderEnabled(Cura.ExtruderManager.activeExtruderIndex, !parent.checked) + } } }