ExpandableComponentHeader.qml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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.2 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. Label
  20. {
  21. id: headerLabel
  22. text: ""
  23. font: UM.Theme.getFont("medium")
  24. renderType: Text.NativeRendering
  25. verticalAlignment: Text.AlignVCenter
  26. color: UM.Theme.getColor("small_button_text")
  27. height: parent.height
  28. anchors
  29. {
  30. topMargin: UM.Theme.getSize("default_margin").height
  31. left: parent.left
  32. leftMargin: UM.Theme.getSize("default_margin").height
  33. }
  34. }
  35. Button
  36. {
  37. id: closeButton
  38. width: UM.Theme.getSize("message_close").width
  39. height: UM.Theme.getSize("message_close").height
  40. hoverEnabled: true
  41. anchors
  42. {
  43. right: parent.right
  44. rightMargin: UM.Theme.getSize("default_margin").width
  45. verticalCenter: parent.verticalCenter
  46. }
  47. contentItem: UM.RecolorImage
  48. {
  49. anchors.fill: parent
  50. sourceSize.width: width
  51. color: closeButton.hovered ? UM.Theme.getColor("small_button_text_hover") : UM.Theme.getColor("small_button_text")
  52. source: UM.Theme.getIcon("cross1")
  53. }
  54. background: Item {}
  55. onClicked: toggleContent() // Will hide the popup item
  56. }
  57. }