ExpandableComponentHeader.qml 1.8 KB

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