Update menu for PrinterType button

CURA-8683
This commit is contained in:
Jaime van Kessel 2022-01-11 11:43:01 +01:00
parent b30ad58f91
commit f8906597e5
2 changed files with 9 additions and 11 deletions

View file

@ -35,7 +35,7 @@ Item
}
}
//Printer type selector.
// Printer type selector.
Item
{
id: printerTypeSelectorRow
@ -64,17 +64,18 @@ Item
anchors.left: parent.left
}
OldControls.ToolButton
Button
{
id: printerTypeSelector
text: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.definition.name: ""
tooltip: text
height: UM.Theme.getSize("print_setup_big_item").height
width: Math.round(parent.width * 0.7) + UM.Theme.getSize("default_margin").width
anchors.right: parent.right
style: UM.Theme.styles.print_setup_header_button
onClicked: menu.open()
//style: UM.Theme.styles.print_setup_header_button
menu: Cura.PrinterTypeMenu { }
Cura.PrinterTypeMenu { id: menu}
}
}

View file

@ -2,9 +2,9 @@
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Controls 2.4
import UM 1.3 as UM
import UM 1.5 as UM
import Cura 1.0 as Cura
Menu
@ -18,12 +18,11 @@ Menu
id: printerTypeInstantiator
model: outputDevice != null ? outputDevice.connectedPrintersTypeCount : []
MenuItem
UM.MenuItem
{
text: modelData.machine_type
checkable: true
checked: Cura.MachineManager.activeMachine.definition.name == modelData.machine_type
exclusiveGroup: group
onTriggered:
{
Cura.MachineManager.switchPrinterType(modelData.machine_type)
@ -32,6 +31,4 @@ Menu
onObjectAdded: menu.insertItem(index, object)
onObjectRemoved: menu.removeItem(object)
}
ExclusiveGroup { id: group }
}