ExtruderIcon.qml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 QtQuick.Controls 1.1
  5. import UM 1.2 as UM
  6. Item
  7. {
  8. id: extruderIconItem
  9. implicitWidth: UM.Theme.getSize("extruder_icon").width
  10. implicitHeight: UM.Theme.getSize("extruder_icon").height
  11. property bool checked: true
  12. property color materialColor
  13. property alias textColor: extruderNumberText.color
  14. property bool extruderEnabled: true
  15. Item
  16. {
  17. opacity: extruderEnabled ? 1 : 0.4
  18. anchors.fill: parent
  19. UM.RecolorImage
  20. {
  21. anchors.fill: parent
  22. source: UM.Theme.getIcon("ExtruderColor", "medium")
  23. color: materialColor
  24. }
  25. UM.RecolorImage
  26. {
  27. id: mainIcon
  28. anchors.fill: parent
  29. source: UM.Theme.getIcon("Extruder", "medium")
  30. color: UM.Theme.getColor("text")
  31. }
  32. Label
  33. {
  34. id: extruderNumberText
  35. anchors.centerIn: parent
  36. text: index + 1
  37. font: UM.Theme.getFont("small")
  38. color: UM.Theme.getColor("text")
  39. width: contentWidth
  40. height: contentHeight
  41. renderType: Text.NativeRendering
  42. horizontalAlignment: Text.AlignHCenter
  43. verticalAlignment: Text.AlignVCenter
  44. }
  45. }
  46. }