ToolboxTabButton.qml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Toolbox is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.10
  4. import QtQuick.Controls 2.3
  5. import UM 1.1 as UM
  6. Button
  7. {
  8. id: control
  9. property bool active: false
  10. implicitWidth: UM.Theme.getSize("toolbox_header_tab").width
  11. implicitHeight: UM.Theme.getSize("toolbox_header_tab").height
  12. background: Item
  13. {
  14. id: backgroundItem
  15. Rectangle
  16. {
  17. id: highlight
  18. visible: control.active
  19. color: UM.Theme.getColor("primary")
  20. anchors.bottom: parent.bottom
  21. width: parent.width
  22. height: UM.Theme.getSize("toolbox_header_highlight").height
  23. }
  24. }
  25. contentItem: Label
  26. {
  27. id: label
  28. text: control.text
  29. color: UM.Theme.getColor("toolbox_header_button_text_inactive")
  30. font: UM.Theme.getFont("medium")
  31. verticalAlignment: Text.AlignVCenter
  32. horizontalAlignment: Text.AlignHCenter
  33. renderType: Text.NativeRendering
  34. }
  35. states:
  36. [
  37. State
  38. {
  39. name: "disabled"
  40. when: !control.enabled
  41. PropertyChanges
  42. {
  43. target: label
  44. font: UM.Theme.getFont("default_italic")
  45. }
  46. },
  47. State
  48. {
  49. name: "active"
  50. when: control.active
  51. PropertyChanges
  52. {
  53. target: label
  54. font: UM.Theme.getFont("medium_bold")
  55. color: UM.Theme.getColor("action_button_text")
  56. }
  57. }
  58. ]
  59. }