SettingVisibilityPresetsMenu.qml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. title: catalog.i18nc("@action:inmenu", "Visible Settings")
  11. property QtObject settingVisibilityPresetsModel: CuraApplication.getSettingVisibilityPresetsModel()
  12. signal collapseAllCategories()
  13. Instantiator
  14. {
  15. model: settingVisibilityPresetsModel.items
  16. MenuItem
  17. {
  18. text: modelData.name
  19. checkable: true
  20. checked: modelData.presetId == settingVisibilityPresetsModel.activePreset
  21. exclusiveGroup: group
  22. onTriggered:
  23. {
  24. settingVisibilityPresetsModel.setActivePreset(modelData.presetId);
  25. }
  26. }
  27. onObjectAdded: menu.insertItem(index, object)
  28. onObjectRemoved: menu.removeItem(object)
  29. }
  30. MenuSeparator {}
  31. MenuItem
  32. {
  33. text: catalog.i18nc("@action:inmenu", "Collapse All Categories")
  34. onTriggered:
  35. {
  36. collapseAllCategories();
  37. }
  38. }
  39. MenuSeparator {}
  40. MenuItem
  41. {
  42. text: catalog.i18nc("@action:inmenu", "Manage Setting Visibility...")
  43. iconName: "configure"
  44. onTriggered: Cura.Actions.configureSettingVisibility.trigger()
  45. }
  46. ExclusiveGroup { id: group }
  47. }