PrinterTypeMenu.qml 968 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.7
  4. import QtQuick.Controls 1.4
  5. import UM 1.3 as UM
  6. import Cura 1.0 as Cura
  7. Menu
  8. {
  9. id: menu
  10. title: "Printer type"
  11. property var outputDevice: Cura.MachineManager.printerOutputDevices[0]
  12. Instantiator
  13. {
  14. id: printerTypeInstantiator
  15. model: outputDevice != null ? outputDevice.connectedPrintersTypeCount : []
  16. MenuItem
  17. {
  18. text: modelData.machine_type
  19. checkable: true
  20. checked: Cura.MachineManager.activeMachineDefinitionName == modelData.machine_type
  21. exclusiveGroup: group
  22. onTriggered:
  23. {
  24. Cura.MachineManager.switchPrinterType(modelData.machine_type)
  25. }
  26. }
  27. onObjectAdded: menu.insertItem(index, object)
  28. onObjectRemoved: menu.removeItem(object)
  29. }
  30. ExclusiveGroup { id: group }
  31. }