ProfileMenu.qml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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.2 as UM
  6. import Cura 1.0 as Cura
  7. Menu
  8. {
  9. id: menu
  10. Instantiator
  11. {
  12. model: Cura.QualityProfilesDropDownMenuModel
  13. MenuItem
  14. {
  15. text: (model.layer_height != "") ? model.name + " - " + model.layer_height + model.layer_height_unit : model.name
  16. checkable: true
  17. checked: Cura.MachineManager.activeQualityOrQualityChangesName == model.name
  18. exclusiveGroup: group
  19. onTriggered: {
  20. Cura.MachineManager.setQualityGroup(model.quality_group)
  21. }
  22. visible: model.available
  23. }
  24. onObjectAdded: menu.insertItem(index, object);
  25. onObjectRemoved: menu.removeItem(object);
  26. }
  27. MenuSeparator
  28. {
  29. id: customSeparator
  30. visible: Cura.CustomQualityProfilesDropDownMenuModel.rowCount > 0
  31. }
  32. Instantiator
  33. {
  34. id: customProfileInstantiator
  35. model: Cura.CustomQualityProfilesDropDownMenuModel
  36. Connections
  37. {
  38. target: Cura.CustomQualityProfilesDropDownMenuModel
  39. onModelReset: customSeparator.visible = Cura.CustomQualityProfilesDropDownMenuModel.rowCount() > 0
  40. }
  41. MenuItem
  42. {
  43. text: model.name
  44. checkable: true
  45. checked: Cura.MachineManager.activeQualityOrQualityChangesName == model.name
  46. exclusiveGroup: group
  47. onTriggered: Cura.MachineManager.setQualityChangesGroup(model.quality_changes_group)
  48. }
  49. onObjectAdded:
  50. {
  51. customSeparator.visible = model.rowCount() > 0;
  52. menu.insertItem(index, object);
  53. }
  54. onObjectRemoved:
  55. {
  56. customSeparator.visible = model.rowCount() > 0;
  57. menu.removeItem(object);
  58. }
  59. }
  60. ExclusiveGroup { id: group; }
  61. MenuSeparator { id: profileMenuSeparator }
  62. MenuItem { action: Cura.Actions.addProfile }
  63. MenuItem { action: Cura.Actions.updateProfile }
  64. MenuItem { action: Cura.Actions.resetProfile }
  65. MenuSeparator { }
  66. MenuItem { action: Cura.Actions.manageProfiles }
  67. }