ToolboxTabButton.qml 1.6 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.2
  4. import QtQuick.Controls 1.4
  5. import QtQuick.Controls.Styles 1.4
  6. import UM 1.1 as UM
  7. Button
  8. {
  9. property bool active: false
  10. style: ButtonStyle
  11. {
  12. background: Rectangle
  13. {
  14. color: "transparent"
  15. implicitWidth: UM.Theme.getSize("toolbox_header_tab").width
  16. implicitHeight: UM.Theme.getSize("toolbox_header_tab").height
  17. Rectangle
  18. {
  19. visible: control.active
  20. color: UM.Theme.getColor("sidebar_header_highlight_hover")
  21. anchors.bottom: parent.bottom
  22. width: parent.width
  23. height: UM.Theme.getSize("sidebar_header_highlight").height
  24. }
  25. }
  26. label: Label
  27. {
  28. text: control.text
  29. color:
  30. {
  31. if(control.hovered)
  32. {
  33. return UM.Theme.getColor("topbar_button_text_hovered");
  34. }
  35. if(control.active)
  36. {
  37. return UM.Theme.getColor("topbar_button_text_active");
  38. }
  39. else
  40. {
  41. return UM.Theme.getColor("topbar_button_text_inactive");
  42. }
  43. }
  44. font: control.enabled ? (control.active ? UM.Theme.getFont("medium_bold") : UM.Theme.getFont("medium")) : UM.Theme.getFont("default_italic")
  45. verticalAlignment: Text.AlignVCenter
  46. horizontalAlignment: Text.AlignHCenter
  47. }
  48. }
  49. }