ExpandableComponentHeader.qml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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("background_1")
  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. height: parent.height
  25. anchors
  26. {
  27. topMargin: UM.Theme.getSize("default_margin").height
  28. left: parent.left
  29. leftMargin: UM.Theme.getSize("default_margin").height
  30. }
  31. }
  32. Button
  33. {
  34. id: closeButton
  35. width: UM.Theme.getSize("message_close").width
  36. height: UM.Theme.getSize("message_close").height
  37. hoverEnabled: true
  38. anchors
  39. {
  40. right: parent.right
  41. rightMargin: UM.Theme.getSize("default_margin").width
  42. verticalCenter: parent.verticalCenter
  43. }
  44. contentItem: UM.RecolorImage
  45. {
  46. anchors.fill: parent
  47. sourceSize.width: width
  48. color: closeButton.hovered ? UM.Theme.getColor("small_button_text_hover") : UM.Theme.getColor("small_button_text")
  49. source: UM.Theme.getIcon("Cancel")
  50. }
  51. background: Item {}
  52. onClicked: toggleContent() // Will hide the popup item
  53. }
  54. }