RecommendedQualityProfileSelectorButton.qml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. signal clicked()
  18. MouseArea
  19. {
  20. id: mouseArea
  21. anchors.fill: parent
  22. hoverEnabled: true
  23. onClicked: base.clicked()
  24. }
  25. Item
  26. {
  27. width: intentIcon.width
  28. anchors
  29. {
  30. top: parent.top
  31. bottom: qualityLabel.top
  32. horizontalCenter: parent.horizontalCenter
  33. topMargin: UM.Theme.getSize("narrow_margin").height
  34. }
  35. Item
  36. {
  37. id: intentIcon
  38. width: UM.Theme.getSize("recommended_button_icon").width
  39. height: UM.Theme.getSize("recommended_button_icon").height
  40. UM.ColorImage
  41. {
  42. anchors.fill: parent
  43. anchors.centerIn: parent
  44. visible: icon != ""
  45. source: UM.Theme.getIcon(icon)
  46. color: UM.Theme.getColor("icon")
  47. }
  48. Rectangle
  49. {
  50. id: circle
  51. anchors.fill: parent
  52. radius: width
  53. anchors.verticalCenter: parent.verticalCenter
  54. visible: icon == ""
  55. border.width: UM.Theme.getSize("thick_lining").width
  56. border.color: UM.Theme.getColor("text")
  57. UM.Label
  58. {
  59. id: initialLabel
  60. anchors.centerIn: parent
  61. text: profileName.charAt(0).toUpperCase()
  62. font: UM.Theme.getFont("small_bold")
  63. horizontalAlignment: Text.AlignHCenter
  64. }
  65. }
  66. }
  67. }
  68. UM.Label
  69. {
  70. id: qualityLabel
  71. text: profileName
  72. anchors
  73. {
  74. bottom: parent.bottom
  75. horizontalCenter: parent.horizontalCenter
  76. bottomMargin: UM.Theme.getSize("narrow_margin").height
  77. }
  78. }
  79. }