MonitorIconExtruder.qml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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.3 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: "../svg/icons/extruder.svg"
  21. height: size
  22. width: size
  23. UM.RecolorImage
  24. {
  25. id: icon
  26. anchors.fill: parent
  27. source: iconSource
  28. width: size
  29. }
  30. Label
  31. {
  32. id: positionLabel
  33. font: UM.Theme.getFont("small")
  34. color: UM.Theme.getColor("monitor_text_primary")
  35. height: Math.round(size / 2)
  36. horizontalAlignment: Text.AlignHCenter
  37. text: position + 1
  38. verticalAlignment: Text.AlignVCenter
  39. width: Math.round(size / 2)
  40. x: Math.round(size * 0.25)
  41. y: Math.round(size * 0.15625)
  42. visible: position >= 0
  43. renderType: Text.NativeRendering
  44. }
  45. }