mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-13 22:35:54 +08:00
CURA-4400 added context menu on right click extruder in SidebarHeader
This commit is contained in:
parent
657a52a5e7
commit
c94d88cd9d
@ -91,10 +91,39 @@ Column
|
|||||||
exclusiveGroup: extruderMenuGroup
|
exclusiveGroup: extruderMenuGroup
|
||||||
checked: base.currentExtruderIndex == index
|
checked: base.currentExtruderIndex == index
|
||||||
|
|
||||||
onClicked:
|
MouseArea
|
||||||
{
|
{
|
||||||
forceActiveFocus() // Changing focus applies the currently-being-typed values so it can change the displayed setting values.
|
anchors.fill: parent
|
||||||
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
|
onClicked: {
|
||||||
|
switch (mouse.button) {
|
||||||
|
case Qt.LeftButton:
|
||||||
|
forceActiveFocus(); // Changing focus applies the currently-being-typed values so it can change the displayed setting values.
|
||||||
Cura.ExtruderManager.setActiveExtruderIndex(index);
|
Cura.ExtruderManager.setActiveExtruderIndex(index);
|
||||||
|
break;
|
||||||
|
case Qt.RightButton:
|
||||||
|
extruderMenu.popup();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Menu
|
||||||
|
{
|
||||||
|
id: extruderMenu
|
||||||
|
|
||||||
|
MenuItem {
|
||||||
|
text: catalog.i18nc("@action:inmenu", "Enable Extruder")
|
||||||
|
onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, true)
|
||||||
|
visible: !Cura.MachineManager.getExtruder(model.index).isEnabled
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuItem {
|
||||||
|
text: catalog.i18nc("@action:inmenu", "Disable Extruder")
|
||||||
|
onTriggered: Cura.MachineManager.setExtruderEnabled(model.index, false)
|
||||||
|
visible: Cura.MachineManager.getExtruder(model.index).isEnabled
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
style: ButtonStyle
|
style: ButtonStyle
|
||||||
|
Loading…
x
Reference in New Issue
Block a user