ExtruderIcon.qml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. property alias iconSize: mainIcon.sourceSize
  16. property string iconVariant: "medium"
  17. Item
  18. {
  19. opacity: extruderEnabled ? 1 : UM.Theme.getColor("extruder_disabled").a
  20. anchors.fill: parent
  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. Label
  37. {
  38. id: extruderNumberText
  39. anchors.centerIn: parent
  40. text: index + 1
  41. font: UM.Theme.getFont("small_black")
  42. color: UM.Theme.getColor("text")
  43. width: contentWidth
  44. height: contentHeight
  45. renderType: Text.NativeRendering
  46. horizontalAlignment: Text.AlignHCenter
  47. verticalAlignment: Text.AlignVCenter
  48. }
  49. }
  50. }