ExtruderIcon.qml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Copyright (c) 2022 UltiMaker
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.11
  4. import UM 1.5 as UM
  5. Item
  6. {
  7. id: extruderIconItem
  8. property bool checked: true
  9. property color materialColor
  10. property alias textColor: extruderNumberText.color
  11. property bool extruderEnabled: true
  12. property int iconSize: UM.Theme.getSize("extruder_icon").width
  13. property string iconVariant: "medium"
  14. property alias font: extruderNumberText.font
  15. property alias text: extruderNumberText.text
  16. implicitWidth: iconSize
  17. implicitHeight: iconSize
  18. Item
  19. {
  20. opacity: extruderEnabled ? 1 : UM.Theme.getColor("extruder_disabled").a
  21. anchors.fill: parent
  22. layer.enabled: true // Prevent weird opacity effects.
  23. UM.ColorImage
  24. {
  25. anchors.fill: parent
  26. width: iconSize
  27. height: iconSize
  28. source: UM.Theme.getIcon("ExtruderColor", iconVariant)
  29. color: materialColor
  30. }
  31. UM.ColorImage
  32. {
  33. anchors.fill: parent
  34. width: iconSize
  35. height: iconSize
  36. source: UM.Theme.getIcon("Extruder", iconVariant)
  37. color: extruderNumberText.color
  38. }
  39. UM.Label
  40. {
  41. id: extruderNumberText
  42. width: contentWidth
  43. height: contentHeight
  44. anchors.verticalCenter: parent.verticalCenter
  45. anchors.left: parent.left
  46. anchors.right: parent.right
  47. horizontalAlignment: Text.AlignHCenter
  48. text: (index + 1).toString()
  49. font: UM.Theme.getFont("small_emphasis")
  50. }
  51. }
  52. }