From b09a88075eb10a36f9870866c0630651b51cae66 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 4 Sep 2020 14:48:55 +0200 Subject: [PATCH] Show a visual indication of enabled directly after click This doesn't actually speed up the process, but it does give some indication that something is going on while the changes are happening Contributes to #8250 --- .../ConfigurationMenu/CustomConfiguration.qml | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 010e2e77b0..b9b4d3261a 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -222,11 +222,18 @@ Item OldControls.CheckBox { id: enabledCheckbox - checked: Cura.MachineManager.activeStack != null ? Cura.MachineManager.activeStack.isEnabled : false enabled: !checked || Cura.MachineManager.numberExtrudersEnabled > 1 //Disable if it's the last enabled extruder. height: parent.height style: UM.Theme.styles.checkbox + Binding + { + target: enabledCheckbox + property: "checked" + value: Cura.MachineManager.activeStack.isEnabled + when: Cura.MachineManger.activeStack != null + } + /* 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 @@ -235,8 +242,17 @@ Item MouseArea { anchors.fill: parent - onClicked: Cura.MachineManager.setExtruderEnabled(Cura.ExtruderManager.activeExtruderIndex, !parent.checked) - enabled: parent.enabled + onClicked: + { + if(!parent.enabled) + { + return + } + // Already update the visual indication + parent.checked = !parent.checked + // Update the settings on the background! + Cura.MachineManager.setExtruderEnabled(Cura.ExtruderManager.activeExtruderIndex, parent.checked) + } } } }