SettingCategory.qml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // Copyright (c) 2015 Ultimaker B.V.
  2. // Uranium is released under the terms of the AGPLv3 or higher.
  3. import QtQuick 2.2
  4. import QtQuick.Controls 1.1
  5. import QtQuick.Controls.Styles 1.1
  6. import QtQuick.Layouts 1.1
  7. import UM 1.1 as UM
  8. Button {
  9. id: base;
  10. style: UM.Theme.styles.sidebar_category;
  11. signal showTooltip();
  12. signal hideTooltip();
  13. signal contextMenuRequested()
  14. text: definition.label
  15. iconSource: UM.Theme.getIcon(definition.icon)
  16. checkable: true
  17. checked: definition.expanded
  18. onClicked: definition.expanded ? settingDefinitionsModel.collapse(definition.key) : settingDefinitionsModel.expandAll(definition.key)
  19. UM.SimpleButton {
  20. id: settingsButton
  21. visible: base.hovered || settingsButton.hovered
  22. height: base.height * 0.6
  23. width: base.height * 0.6
  24. anchors {
  25. right: inheritButton.visible ? inheritButton.left : parent.right
  26. rightMargin: inheritButton.visible? UM.Theme.getSize("default_margin").width / 2 : UM.Theme.getSize("setting_preferences_button_margin").width
  27. verticalCenter: parent.verticalCenter;
  28. }
  29. color: UM.Theme.getColor("setting_control_button");
  30. hoverColor: UM.Theme.getColor("setting_control_button_hover")
  31. iconSource: UM.Theme.getIcon("settings");
  32. onClicked: {
  33. Actions.configureSettingVisibility()
  34. }
  35. }
  36. UM.SimpleButton
  37. {
  38. // This button shows when the setting has an inherited function, but is overriden by profile.
  39. id: inheritButton;
  40. anchors.verticalCenter: parent.verticalCenter
  41. anchors.right: parent.right
  42. anchors.rightMargin: UM.Theme.getSize("setting_preferences_button_margin").width
  43. visible: hiddenValuesCount > 0
  44. height: parent.height / 2;
  45. width: height;
  46. onClicked: {
  47. base.showAllHidenInheritedSettings()
  48. }
  49. color: UM.Theme.getColor("setting_control_button")
  50. hoverColor: UM.Theme.getColor("setting_control_button_hover")
  51. iconSource: UM.Theme.getIcon("notice")
  52. onEntered: {
  53. base.showTooltip()
  54. }
  55. onExited: {
  56. base.hideTooltip();
  57. }
  58. }
  59. }