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
This commit is contained in:
Jaime van Kessel 2020-09-04 14:48:55 +02:00
parent 8c0e21f0d5
commit b09a88075e
No known key found for this signature in database
GPG Key ID: 3710727397403C91

View File

@ -222,11 +222,18 @@ Item
OldControls.CheckBox OldControls.CheckBox
{ {
id: enabledCheckbox 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. enabled: !checked || Cura.MachineManager.numberExtrudersEnabled > 1 //Disable if it's the last enabled extruder.
height: parent.height height: parent.height
style: UM.Theme.styles.checkbox 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. /* Use a MouseArea to process the click on this checkbox.
This is necessary because actually clicking the checkbox This is necessary because actually clicking the checkbox
causes the "checked" property to be overwritten. After causes the "checked" property to be overwritten. After
@ -235,8 +242,17 @@ Item
MouseArea MouseArea
{ {
anchors.fill: parent anchors.fill: parent
onClicked: Cura.MachineManager.setExtruderEnabled(Cura.ExtruderManager.activeExtruderIndex, !parent.checked) onClicked:
enabled: parent.enabled {
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)
}
} }
} }
} }