NozzleMenu.qml 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright (c) 2022 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.10
  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: nozzleMenu
  10. title: "Nozzle"
  11. property int extruderIndex: 0
  12. Cura.NozzleModel
  13. {
  14. id: nozzleModel
  15. }
  16. Instantiator
  17. {
  18. model: nozzleModel
  19. Cura.MenuItem
  20. {
  21. text: model.hotend_name
  22. checkable: true
  23. checked:
  24. {
  25. const extruder = Cura.MachineManager.activeMachineExtruders[extruderIndex];
  26. if (!extruder) return false;
  27. return extruder.variant.name == model.hotend_name;
  28. }
  29. enabled:
  30. {
  31. const extruder = Cura.MachineManager.activeMachineExtruders[extruderIndex];
  32. if (!extruder) return false;
  33. return extruder.isEnabled;
  34. }
  35. onTriggered: Cura.MachineManager.setVariant(nozzleMenu.extruderIndex, model.container_node)
  36. }
  37. onObjectAdded: function(index, object) { nozzleMenu.insertItem(index, object) }
  38. onObjectRemoved: function(index, object) {nozzleMenu.removeItem(object)}
  39. }
  40. }