SettingVisibilityPresetsMenu.qml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright (c) 2021 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.11
  5. import QtQml.Models 2.14 as Models
  6. import UM 1.2 as UM
  7. import Cura 1.0 as Cura
  8. Cura.Menu
  9. {
  10. ActionGroup { id: group }
  11. id: menu
  12. title: catalog.i18nc("@action:inmenu", "Visible Settings")
  13. property QtObject settingVisibilityPresetsModel: CuraApplication.getSettingVisibilityPresetsModel()
  14. signal collapseAllCategories()
  15. Models.Instantiator
  16. {
  17. model: settingVisibilityPresetsModel.items
  18. Cura.MenuItem
  19. {
  20. text: modelData.name
  21. checkable: true
  22. checked: modelData.presetId == settingVisibilityPresetsModel.activePreset
  23. ActionGroup.group: group
  24. onTriggered:
  25. {
  26. settingVisibilityPresetsModel.setActivePreset(modelData.presetId);
  27. }
  28. }
  29. onObjectAdded: menu.insertItem(index, object)
  30. onObjectRemoved: menu.removeItem(object)
  31. }
  32. Cura.MenuSeparator {}
  33. Cura.MenuItem
  34. {
  35. text: catalog.i18nc("@action:inmenu", "Collapse All Categories")
  36. onTriggered:
  37. {
  38. collapseAllCategories();
  39. }
  40. }
  41. Cura.MenuSeparator {}
  42. Cura.MenuItem
  43. {
  44. text: catalog.i18nc("@action:inmenu", "Manage Setting Visibility...")
  45. icon.name: "configure"
  46. onTriggered: Cura.Actions.configureSettingVisibility.trigger()
  47. }
  48. }