PerObjectCategory.qml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Copyright (c) 2022 Ultimaker B.V.
  2. // Uranium is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.2
  4. import QtQuick.Controls 2.1
  5. import UM 1.5 as UM
  6. import Cura 1.0 as Cura
  7. import ".."
  8. Button {
  9. id: base;
  10. background: Rectangle {
  11. color: UM.Theme.getColor("category_background")
  12. }
  13. contentItem: Row
  14. {
  15. spacing: UM.Theme.getSize("default_lining").width
  16. Item //Wrapper to give space before icon with fixed width. This allows aligning checkbox with category icon.
  17. {
  18. height: label.height
  19. width: height
  20. anchors.verticalCenter: parent.verticalCenter
  21. UM.RecolorImage
  22. {
  23. anchors.verticalCenter: parent.verticalCenter
  24. height: (label.height / 2) | 0
  25. width: height
  26. source: base.checked ? UM.Theme.getIcon("ChevronSingleDown") : UM.Theme.getIcon("ChevronSingleRight")
  27. color: base.hovered ? UM.Theme.getColor("primary_button_hover"): UM.Theme.getColor("text")
  28. }
  29. }
  30. UM.RecolorImage
  31. {
  32. anchors.verticalCenter: parent.verticalCenter
  33. height: label.height
  34. width: height
  35. source: UM.Theme.getIcon(definition.icon)
  36. color: base.hovered ? UM.Theme.getColor("primary_button_hover") : UM.Theme.getColor("text")
  37. }
  38. UM.Label
  39. {
  40. id: label
  41. anchors.verticalCenter: parent.verticalCenter
  42. text: base.text
  43. color: base.hovered ? UM.Theme.getColor("primary_button_hover") : UM.Theme.getColor("text")
  44. font.bold: true
  45. }
  46. }
  47. signal showTooltip(string text)
  48. signal hideTooltip()
  49. signal contextMenuRequested()
  50. text: definition.label
  51. checkable: true
  52. checked: definition.expanded
  53. onClicked: definition.expanded ? settingDefinitionsModel.collapseRecursive(definition.key) : settingDefinitionsModel.expandRecursive(definition.key)
  54. }