RecommendedQualityProfileSelectorButton.qml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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("um_blue_1") : 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. color: transparent
  56. border.width: UM.Theme.getSize("thick_lining").width
  57. border.color: UM.Theme.getColor("text")
  58. UM.Label
  59. {
  60. id: initialLabel
  61. anchors.centerIn: parent
  62. text: profileName.charAt(0).toUpperCase()
  63. font: UM.Theme.getFont("small_bold")
  64. horizontalAlignment: Text.AlignHCenter
  65. }
  66. }
  67. }
  68. }
  69. UM.Label
  70. {
  71. id: qualityLabel
  72. text: profileName
  73. anchors
  74. {
  75. bottom: parent.bottom
  76. horizontalCenter: parent.horizontalCenter
  77. bottomMargin: UM.Theme.getSize("narrow_margin").height
  78. }
  79. }
  80. }