ToolboxTabButton.qml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. hoverEnabled: true
  11. background: Item
  12. {
  13. implicitWidth: UM.Theme.getSize("toolbox_header_tab").width
  14. implicitHeight: UM.Theme.getSize("toolbox_header_tab").height
  15. Rectangle
  16. {
  17. visible: control.active
  18. color: UM.Theme.getColor("primary")
  19. anchors.bottom: parent.bottom
  20. width: parent.width
  21. height: UM.Theme.getSize("toolbox_header_highlight").height
  22. }
  23. }
  24. contentItem: Label
  25. {
  26. id: label
  27. text: control.text
  28. color:
  29. {
  30. if(control.hovered)
  31. {
  32. return UM.Theme.getColor("toolbox_header_button_text_hovered");
  33. }
  34. if(control.active)
  35. {
  36. return UM.Theme.getColor("toolbox_header_button_text_active");
  37. }
  38. else
  39. {
  40. return UM.Theme.getColor("toolbox_header_button_text_inactive");
  41. }
  42. }
  43. font: control.enabled ? (control.active ? UM.Theme.getFont("medium_bold") : UM.Theme.getFont("medium")) : UM.Theme.getFont("default_italic")
  44. verticalAlignment: Text.AlignVCenter
  45. horizontalAlignment: Text.AlignHCenter
  46. renderType: Text.NativeRendering
  47. }
  48. }