PrinterCard.qml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // Copyright (c) 2022 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.10
  4. import QtQuick.Controls 2.3
  5. import QtQuick.Layouts 1.3
  6. import UM 1.5 as UM
  7. import Cura 1.1 as Cura
  8. Control
  9. {
  10. id: root
  11. property alias text: link_text.text
  12. property alias imageSource: image.source
  13. property var onClicked
  14. states:
  15. [
  16. State
  17. {
  18. name: "hovered";
  19. when: mouse_area.containsMouse
  20. PropertyChanges
  21. {
  22. target: background
  23. color: UM.Theme.getColor("monitor_card_hover")
  24. }
  25. PropertyChanges
  26. {
  27. target: link_text
  28. font.underline: true
  29. }
  30. }
  31. ]
  32. MouseArea
  33. {
  34. id: mouse_area
  35. anchors.fill: parent
  36. hoverEnabled: true
  37. onClicked: root.onClicked && root.onClicked()
  38. }
  39. rightPadding: UM.Theme.getSize("wide_margin").width
  40. bottomPadding: UM.Theme.getSize("wide_margin").height
  41. leftPadding: UM.Theme.getSize("wide_margin").width
  42. background: Rectangle
  43. {
  44. id: background
  45. height: parent.height
  46. border.color: UM.Theme.getColor("primary_button")
  47. color: "transparent"
  48. border.width: 1
  49. radius: 3
  50. }
  51. contentItem: ColumnLayout
  52. {
  53. id: column
  54. spacing: UM.Theme.getSize("wide_margin").height
  55. height: childrenRect.height
  56. width: childrenRect.width
  57. Image
  58. {
  59. id: image
  60. source: imageSource
  61. width: 180 * screenScaleFactor
  62. sourceSize.width: width
  63. sourceSize.height: height
  64. }
  65. UM.Label
  66. {
  67. id: link_text
  68. Layout.fillWidth: true
  69. font: UM.Theme.getFont("medium")
  70. color: UM.Theme.getColor("text_link")
  71. horizontalAlignment: Text.AlignHCenter
  72. }
  73. }
  74. }