ExtruderIcon.qml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. implicitWidth: iconSize
  16. implicitHeight: iconSize
  17. Item
  18. {
  19. opacity: extruderEnabled ? 1 : UM.Theme.getColor("extruder_disabled").a
  20. anchors.fill: parent
  21. layer.enabled: true // Prevent weird opacity effects.
  22. UM.ColorImage
  23. {
  24. anchors.fill: parent
  25. width: iconSize
  26. height: iconSize
  27. source: UM.Theme.getIcon("ExtruderColor", iconVariant)
  28. color: materialColor
  29. }
  30. UM.ColorImage
  31. {
  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. width: contentWidth
  42. height: contentHeight
  43. anchors.verticalCenter: parent.verticalCenter
  44. anchors.left: parent.left
  45. anchors.right: parent.right
  46. horizontalAlignment: Text.AlignHCenter
  47. text: (index + 1).toString()
  48. font: UM.Theme.getFont("small_emphasis")
  49. }
  50. }
  51. }