PerObjectCategory.qml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright (c) 2015 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.2
  5. import QtQuick.Controls.Styles 2.2
  6. import QtQuick.Layouts 1.1
  7. import UM 1.1 as UM
  8. import ".."
  9. Button {
  10. id: base;
  11. style: ButtonStyle {
  12. background: Item { }
  13. label: Row
  14. {
  15. spacing: UM.Theme.getSize("default_lining").width
  16. UM.RecolorImage
  17. {
  18. anchors.verticalCenter: parent.verticalCenter
  19. height: (label.height / 2) | 0
  20. width: height
  21. source: control.checked ? UM.Theme.getIcon("ChevronSingleDown") : UM.Theme.getIcon("ChevronSingleRight");
  22. color: control.hovered ? palette.highlight : palette.buttonText
  23. }
  24. UM.RecolorImage
  25. {
  26. anchors.verticalCenter: parent.verticalCenter
  27. height: label.height
  28. width: height
  29. source: control.iconSource
  30. color: control.hovered ? palette.highlight : palette.buttonText
  31. }
  32. Label
  33. {
  34. id: label
  35. anchors.verticalCenter: parent.verticalCenter
  36. text: control.text
  37. color: control.hovered ? palette.highlight : palette.buttonText
  38. font.bold: true
  39. }
  40. SystemPalette { id: palette }
  41. }
  42. }
  43. signal showTooltip(string text);
  44. signal hideTooltip();
  45. signal contextMenuRequested()
  46. text: definition.label
  47. iconSource: UM.Theme.getIcon(definition.icon)
  48. checkable: true
  49. checked: definition.expanded
  50. onClicked: definition.expanded ? settingDefinitionsModel.collapseRecursive(definition.key) : settingDefinitionsModel.expandRecursive(definition.key)
  51. }