PrinterTypeMenu.qml 984 B

12345678910111213141516171819202122232425262728293031323334
  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 2.4
  5. import UM 1.5 as UM
  6. import Cura 1.0 as Cura
  7. Cura.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. Cura.MenuItem
  17. {
  18. text: modelData.machine_type
  19. checkable: true
  20. checked: Cura.MachineManager.activeMachine.definition.name == modelData.machine_type
  21. onTriggered:
  22. {
  23. Cura.MachineManager.switchPrinterType(modelData.machine_type)
  24. }
  25. }
  26. onObjectAdded: function(index, object) { return menu.insertItem(index, object); }
  27. onObjectRemoved: function(index, object) { return menu.removeItem(object); }
  28. }
  29. }