SettingCategory.qml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. import Cura 1.0 as Cura
  9. Button {
  10. id: base;
  11. style: UM.Theme.styles.sidebar_category;
  12. signal showTooltip(string text);
  13. signal hideTooltip();
  14. signal contextMenuRequested()
  15. text: definition.label
  16. iconSource: UM.Theme.getIcon(definition.icon)
  17. checkable: true
  18. checked: definition.expanded
  19. onClicked: { forceActiveFocus(); definition.expanded ? settingDefinitionsModel.collapse(definition.key) : settingDefinitionsModel.expandAll(definition.key) }
  20. UM.SimpleButton
  21. {
  22. id: settingsButton
  23. visible: base.hovered || settingsButton.hovered
  24. height: base.height * 0.6
  25. width: base.height * 0.6
  26. anchors {
  27. right: inheritButton.visible ? inheritButton.left : parent.right
  28. rightMargin: inheritButton.visible? UM.Theme.getSize("default_margin").width / 2 : UM.Theme.getSize("setting_preferences_button_margin").width
  29. verticalCenter: parent.verticalCenter;
  30. }
  31. color: UM.Theme.getColor("setting_control_button");
  32. hoverColor: UM.Theme.getColor("setting_control_button_hover")
  33. iconSource: UM.Theme.getIcon("settings");
  34. onClicked: {
  35. Cura.Actions.configureSettingVisibility.trigger(definition)
  36. }
  37. }
  38. UM.SimpleButton
  39. {
  40. id: inheritButton;
  41. anchors.verticalCenter: parent.verticalCenter
  42. anchors.right: parent.right
  43. anchors.rightMargin: UM.Theme.getSize("setting_preferences_button_margin").width
  44. visible: false //hiddenValuesCount > 0
  45. height: parent.height / 2
  46. width: height
  47. onClicked:
  48. {
  49. base.showAllHiddenInheritedSettings()
  50. }
  51. color: UM.Theme.getColor("setting_control_button")
  52. hoverColor: UM.Theme.getColor("setting_control_button_hover")
  53. iconSource: UM.Theme.getIcon("notice")
  54. onEntered:
  55. {
  56. base.showTooltip(catalog.i18nc("@label","Some hidden settings use values different from their normal calculated value.\n\nClick to make these settings visible."))
  57. }
  58. onExited:
  59. {
  60. base.hideTooltip();
  61. }
  62. UM.I18nCatalog { id: catalog; name: "cura" }
  63. }
  64. }