MonitorIconExtruder.qml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright (c) 2019 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.2
  4. import QtQuick.Controls 2.0
  5. import UM 1.5 as UM
  6. /**
  7. * This component is a sort of "super icon" which includes a colored SVG image
  8. * as well as the extruder position number. It is used in the the
  9. * MonitorExtruderConfiguration component.
  10. */
  11. Item
  12. {
  13. // The material color
  14. property alias color: icon.color
  15. // The extruder position; NOTE: Decent human beings count from 0
  16. property int position: 0
  17. // The extruder icon size; NOTE: This shouldn't need to be changed
  18. property int size: 32 * screenScaleFactor // TODO: Theme!
  19. // THe extruder icon source; NOTE: This shouldn't need to be changed
  20. property string iconSource: Qt.resolvedUrl("../svg/icons/Extruder.svg")
  21. height: size
  22. width: size
  23. UM.ColorImage
  24. {
  25. id: icon
  26. anchors.fill: parent
  27. source: iconSource
  28. width: size
  29. }
  30. UM.Label
  31. {
  32. id: positionLabel
  33. anchors.centerIn: icon
  34. font: UM.Theme.getFont("small")
  35. height: Math.round(size / 2)
  36. horizontalAlignment: Text.AlignHCenter
  37. text: position + 1
  38. width: Math.round(size / 2)
  39. visible: position >= 0
  40. }
  41. }