mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-18 19:15:53 +08:00
Fix the settings menu not reacting to onTriggered signals
This commit is contained in:
parent
52f5a1f8bc
commit
3f8a65d926
@ -31,6 +31,7 @@ Menu
|
|||||||
return Cura.MachineManager.activeVariantNames[extruderIndex] == model.hotend_name
|
return Cura.MachineManager.activeVariantNames[extruderIndex] == model.hotend_name
|
||||||
}
|
}
|
||||||
exclusiveGroup: group
|
exclusiveGroup: group
|
||||||
|
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
Cura.MachineManager.setVariant(menu.extruderIndex, model.container_node);
|
Cura.MachineManager.setVariant(menu.extruderIndex, model.container_node);
|
||||||
}
|
}
|
||||||
|
@ -15,15 +15,10 @@ Menu
|
|||||||
PrinterMenu { title: catalog.i18nc("@title:menu menubar:settings", "&Printer") }
|
PrinterMenu { title: catalog.i18nc("@title:menu menubar:settings", "&Printer") }
|
||||||
|
|
||||||
property var activeMachine: Cura.MachineManager.activeMachine
|
property var activeMachine: Cura.MachineManager.activeMachine
|
||||||
|
|
||||||
onAboutToShow: extruderInstantiator.active = true
|
|
||||||
onAboutToHide: extruderInstantiator.active = false
|
|
||||||
Instantiator
|
Instantiator
|
||||||
{
|
{
|
||||||
id: extruderInstantiator
|
id: extruderInstantiator
|
||||||
model: activeMachine == null ? null : activeMachine.extruderList
|
model: activeMachine == null ? null : activeMachine.extruderList
|
||||||
active: false
|
|
||||||
asynchronous: true
|
|
||||||
Menu
|
Menu
|
||||||
{
|
{
|
||||||
title: modelData.name
|
title: modelData.name
|
||||||
@ -39,41 +34,20 @@ Menu
|
|||||||
MenuItem
|
MenuItem
|
||||||
{
|
{
|
||||||
text: catalog.i18nc("@action:inmenu", "Set as Active Extruder")
|
text: catalog.i18nc("@action:inmenu", "Set as Active Extruder")
|
||||||
// HACK: Instead of directly binding to the onTriggered handle, we have to use this workaround.
|
onTriggered: Cura.ExtruderManager.setActiveExtruderIndex(model.index)
|
||||||
// I've narrowed it down to it being an issue with the instantiator (removing that makes the
|
|
||||||
// onTriggered work directly again).
|
|
||||||
Component.onCompleted:
|
|
||||||
{
|
|
||||||
var index = model.index
|
|
||||||
triggered.connect(function(){Cura.ExtruderManager.setActiveExtruderIndex(index)})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuItem
|
MenuItem
|
||||||
{
|
{
|
||||||
text: catalog.i18nc("@action:inmenu", "Enable Extruder")
|
text: catalog.i18nc("@action:inmenu", "Enable Extruder")
|
||||||
// HACK: Instead of directly binding to the onTriggered handle, we have to use this workaround.
|
onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, true)
|
||||||
// I've narrowed it down to it being an issue with the instantiator (removing that makes the
|
|
||||||
// onTriggered work directly again).
|
|
||||||
Component.onCompleted:
|
|
||||||
{
|
|
||||||
var index = model.index
|
|
||||||
triggered.connect(function(){Cura.MachineManager.setExtruderEnabled(index, true)})
|
|
||||||
}
|
|
||||||
visible: !Cura.MachineManager.getExtruder(model.index).isEnabled
|
visible: !Cura.MachineManager.getExtruder(model.index).isEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuItem
|
MenuItem
|
||||||
{
|
{
|
||||||
text: catalog.i18nc("@action:inmenu", "Disable Extruder")
|
text: catalog.i18nc("@action:inmenu", "Disable Extruder")
|
||||||
// HACK: Instead of directly binding to the onTriggered handle, we have to use this workaround.
|
onTriggered: Cura.MachineManager.setExtruderEnabled(index, false)
|
||||||
// I've narrowed it down to it being an issue with the instantiator (removing that makes the
|
|
||||||
// onTriggered work directly again).
|
|
||||||
Component.onCompleted:
|
|
||||||
{
|
|
||||||
var index = model.index
|
|
||||||
triggered.connect(function(){Cura.MachineManager.setExtruderEnabled(index, false)})
|
|
||||||
}
|
|
||||||
visible: Cura.MachineManager.getExtruder(model.index).isEnabled
|
visible: Cura.MachineManager.getExtruder(model.index).isEnabled
|
||||||
enabled: Cura.MachineManager.numberExtrudersEnabled > 1
|
enabled: Cura.MachineManager.numberExtrudersEnabled > 1
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user