ExpandableComponentHeader.qml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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.ColorImage
  45. {
  46. anchors.fill: parent
  47. color: closeButton.hovered ? UM.Theme.getColor("small_button_text_hover") : UM.Theme.getColor("small_button_text")
  48. source: UM.Theme.getIcon("Cancel")
  49. }
  50. background: Item {}
  51. onClicked: toggleContent() // Will hide the popup item
  52. }
  53. }