DropDownHeader.qml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // Copyright (c) 2019 Ultimaker B.V.
  2. // Cura 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.5 as UM
  6. import Cura 1.1 as Cura
  7. import ".."
  8. //
  9. // This is DropDown Header bar of the expandable drop down list. See comments in DropDownWidget for details.
  10. //
  11. Cura.RoundedRectangle
  12. {
  13. UM.I18nCatalog { id: catalog; name: "cura" }
  14. id: base
  15. border.width: UM.Theme.getSize("default_lining").width
  16. border.color: UM.Theme.getColor("lining")
  17. color: UM.Theme.getColor("secondary")
  18. radius: UM.Theme.getSize("default_radius").width
  19. cornerSide: contentShown ? Cura.RoundedRectangle.Direction.Up : Cura.RoundedRectangle.Direction.All
  20. property string title: ""
  21. property url rightIconSource: UM.Theme.getIcon("ChevronSingleDown")
  22. // If the tab is under hovering state
  23. property bool hovered: false
  24. // If the content is shown
  25. property bool contentShown: false
  26. signal clicked()
  27. MouseArea
  28. {
  29. anchors.fill: parent
  30. hoverEnabled: true
  31. onEntered: base.hovered = true
  32. onExited: base.hovered = false
  33. onClicked: base.clicked()
  34. }
  35. UM.Label
  36. {
  37. id: title
  38. anchors.left: parent.left
  39. anchors.leftMargin: UM.Theme.getSize("default_margin").width
  40. anchors.verticalCenter: parent.verticalCenter
  41. text: base.title
  42. font: UM.Theme.getFont("medium")
  43. color: base.hovered ? UM.Theme.getColor("small_button_text_hover") : UM.Theme.getColor("small_button_text")
  44. }
  45. UM.RecolorImage
  46. {
  47. id: rightIcon
  48. anchors.right: parent.right
  49. anchors.rightMargin: UM.Theme.getSize("default_margin").width
  50. anchors.verticalCenter: parent.verticalCenter
  51. width: UM.Theme.getSize("message_close").width
  52. height: UM.Theme.getSize("message_close").height
  53. color: base.hovered ? UM.Theme.getColor("small_button_text_hover") : UM.Theme.getColor("small_button_text")
  54. source: base.rightIconSource
  55. }
  56. }