ExtruderIcon.qml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright (c) 2021 Ultimaker B.V.
  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 var iconSize: UM.Theme.getSize("extruder_icon").width
  13. property string iconVariant: "medium"
  14. implicitWidth: iconSize
  15. implicitHeight: iconSize
  16. Item
  17. {
  18. opacity: extruderEnabled ? 1 : UM.Theme.getColor("extruder_disabled").a
  19. anchors.fill: parent
  20. layer.enabled: true // Prevent weird opacity effects.
  21. UM.ColorImage
  22. {
  23. anchors.fill: parent
  24. width: iconSize
  25. height: iconSize
  26. source: UM.Theme.getIcon("ExtruderColor", iconVariant)
  27. color: materialColor
  28. }
  29. UM.ColorImage
  30. {
  31. id: mainIcon
  32. anchors.fill: parent
  33. width: iconSize
  34. height: iconSize
  35. source: UM.Theme.getIcon("Extruder", iconVariant)
  36. color: extruderNumberText.color
  37. }
  38. UM.Label
  39. {
  40. id: extruderNumberText
  41. anchors.centerIn: parent
  42. text: index + 1
  43. font: UM.Theme.getFont("small_emphasis")
  44. width: contentWidth
  45. height: contentHeight
  46. horizontalAlignment: Text.AlignHCenter
  47. }
  48. }
  49. }