ExtruderIcon.qml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.7
  4. import QtQuick.Controls 1.1
  5. import UM 1.2 as UM
  6. Item
  7. {
  8. id: extruderIconItem
  9. implicitWidth: UM.Theme.getSize("button").width
  10. implicitHeight: implicitWidth
  11. property bool checked: true
  12. property alias materialColor: mainIcon.color
  13. property alias textColor: extruderNumberText.color
  14. UM.RecolorImage
  15. {
  16. id: mainIcon
  17. anchors.fill: parent
  18. sourceSize.width: parent.width
  19. sourceSize.height: parent.width
  20. source: UM.Theme.getIcon("extruder_button")
  21. }
  22. Rectangle
  23. {
  24. id: extruderNumberCircle
  25. width: height
  26. height: parent.height / 2
  27. radius: Math.round(width / 2)
  28. color: "white"
  29. anchors
  30. {
  31. horizontalCenter: parent.horizontalCenter
  32. top: parent.top
  33. // The circle needs to be slightly off center (so it sits in the middle of the square bit of the icon)
  34. topMargin: (parent.height - height) / 2 - 0.1 * parent.height
  35. }
  36. Label
  37. {
  38. id: extruderNumberText
  39. anchors.centerIn: parent
  40. text: index + 1
  41. font: UM.Theme.getFont("default")
  42. width: contentWidth
  43. height: contentHeight
  44. }
  45. }
  46. }