RecommendedQualityProfileSelectorButton.qml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 2.10
  6. import UM 1.5 as UM
  7. import Cura 1.7 as Cura
  8. Rectangle
  9. {
  10. id: base
  11. height: 60
  12. Layout.fillWidth: true
  13. color: mouseArea.containsMouse || selected ? UM.Theme.getColor("background_3") : UM.Theme.getColor("background_1")
  14. property bool selected: false
  15. property string profileName: ""
  16. property string icon: ""
  17. property alias tooltipText: tooltip.text
  18. signal clicked()
  19. MouseArea
  20. {
  21. id: mouseArea
  22. anchors.fill: parent
  23. hoverEnabled: true
  24. onClicked: base.clicked()
  25. }
  26. UM.ToolTip
  27. {
  28. id: tooltip
  29. visible: mouseArea.containsMouse
  30. targetPoint: Qt.point(base.x + (base.width / 2), base.y + (base.height / 2))
  31. width: UM.Theme.getSize("tooltip").width
  32. }
  33. Item
  34. {
  35. width: intentIcon.width
  36. anchors
  37. {
  38. top: parent.top
  39. bottom: qualityLabel.top
  40. horizontalCenter: parent.horizontalCenter
  41. topMargin: UM.Theme.getSize("narrow_margin").height
  42. }
  43. Item
  44. {
  45. id: intentIcon
  46. width: UM.Theme.getSize("recommended_button_icon").width
  47. height: UM.Theme.getSize("recommended_button_icon").height
  48. UM.ColorImage
  49. {
  50. anchors.fill: parent
  51. anchors.centerIn: parent
  52. visible: icon != ""
  53. source: UM.Theme.getIcon(icon)
  54. color: UM.Theme.getColor("icon")
  55. }
  56. Rectangle
  57. {
  58. id: circle
  59. anchors.fill: parent
  60. radius: width
  61. anchors.verticalCenter: parent.verticalCenter
  62. visible: icon == ""
  63. border.width: UM.Theme.getSize("thick_lining").width
  64. border.color: UM.Theme.getColor("text")
  65. UM.Label
  66. {
  67. id: initialLabel
  68. anchors.centerIn: parent
  69. text: profileName.charAt(0).toUpperCase()
  70. font: UM.Theme.getFont("small_bold")
  71. horizontalAlignment: Text.AlignHCenter
  72. }
  73. }
  74. }
  75. }
  76. UM.Label
  77. {
  78. id: qualityLabel
  79. text: profileName
  80. anchors
  81. {
  82. bottom: parent.bottom
  83. horizontalCenter: parent.horizontalCenter
  84. bottomMargin: UM.Theme.getSize("narrow_margin").height
  85. }
  86. }
  87. }