ExtruderIcon.qml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. implicitWidth: UM.Theme.getSize("extruder_icon").width
  9. implicitHeight: UM.Theme.getSize("extruder_icon").height
  10. property bool checked: true
  11. property color materialColor
  12. property alias textColor: extruderNumberText.color
  13. property bool extruderEnabled: true
  14. property alias iconSize: mainIcon.sourceSize
  15. property string iconVariant: "medium"
  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.RecolorImage
  22. {
  23. anchors.fill: parent
  24. sourceSize: mainIcon.sourceSize
  25. source: UM.Theme.getIcon("ExtruderColor", iconVariant)
  26. color: materialColor
  27. }
  28. UM.RecolorImage
  29. {
  30. id: mainIcon
  31. anchors.fill: parent
  32. sourceSize: UM.Theme.getSize("extruder_icon")
  33. source: UM.Theme.getIcon("Extruder", iconVariant)
  34. color: extruderNumberText.color
  35. }
  36. UM.Label
  37. {
  38. id: extruderNumberText
  39. anchors.centerIn: parent
  40. text: index + 1
  41. font: UM.Theme.getFont("small_emphasis")
  42. width: contentWidth
  43. height: contentHeight
  44. horizontalAlignment: Text.AlignHCenter
  45. }
  46. }
  47. }