PrinterCard.qml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. topPadding: UM.Theme.getSize("wide_margin").height
  40. rightPadding: UM.Theme.getSize("wide_margin").width
  41. bottomPadding: UM.Theme.getSize("wide_margin").height
  42. leftPadding: UM.Theme.getSize("wide_margin").width
  43. background: Rectangle
  44. {
  45. id: background
  46. anchors.fill: parent
  47. border.color: UM.Theme.getColor("primary_button")
  48. color: "transparent"
  49. border.width: 1
  50. radius: 3
  51. }
  52. contentItem: ColumnLayout
  53. {
  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. height: 180 * screenScaleFactor
  63. sourceSize.width: width
  64. sourceSize.height: height
  65. }
  66. UM.Label
  67. {
  68. id: link_text
  69. Layout.fillWidth: true
  70. font: UM.Theme.getFont("medium")
  71. color: UM.Theme.getColor("text_link")
  72. horizontalAlignment: Text.AlignHCenter
  73. }
  74. }
  75. }