ExpandableComponentHeader.qml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.7
  4. import QtQuick.Controls 2.3
  5. import UM 1.5 as UM
  6. import Cura 1.0 as Cura
  7. // Header of the popup
  8. Cura.RoundedRectangle
  9. {
  10. id: header
  11. property alias headerTitle: headerLabel.text
  12. property alias xPosCloseButton: closeButton.left
  13. height: UM.Theme.getSize("expandable_component_content_header").height
  14. color: UM.Theme.getColor("secondary")
  15. cornerSide: Cura.RoundedRectangle.Direction.Up
  16. border.width: UM.Theme.getSize("default_lining").width
  17. border.color: UM.Theme.getColor("lining")
  18. radius: UM.Theme.getSize("default_radius").width
  19. UM.Label
  20. {
  21. id: headerLabel
  22. text: ""
  23. font: UM.Theme.getFont("medium")
  24. color: UM.Theme.getColor("small_button_text")
  25. height: parent.height
  26. anchors
  27. {
  28. topMargin: UM.Theme.getSize("default_margin").height
  29. left: parent.left
  30. leftMargin: UM.Theme.getSize("default_margin").height
  31. }
  32. }
  33. Button
  34. {
  35. id: closeButton
  36. width: UM.Theme.getSize("message_close").width
  37. height: UM.Theme.getSize("message_close").height
  38. hoverEnabled: true
  39. anchors
  40. {
  41. right: parent.right
  42. rightMargin: UM.Theme.getSize("default_margin").width
  43. verticalCenter: parent.verticalCenter
  44. }
  45. contentItem: UM.RecolorImage
  46. {
  47. anchors.fill: parent
  48. sourceSize.width: width
  49. color: closeButton.hovered ? UM.Theme.getColor("small_button_text_hover") : UM.Theme.getColor("small_button_text")
  50. source: UM.Theme.getIcon("Cancel")
  51. }
  52. background: Item {}
  53. onClicked: toggleContent() // Will hide the popup item
  54. }
  55. }