ExtruderIcon.qml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 material_color: materialColorCircle.color
  13. property alias text_color: extruderNumberText.color
  14. UM.RecolorImage
  15. {
  16. id: mainCircle
  17. anchors.fill: parent
  18. sourceSize.width: parent.width
  19. sourceSize.height: parent.width
  20. source: UM.Theme.getIcon("extruder_button")
  21. color: extruderNumberText.color
  22. }
  23. Label
  24. {
  25. id: extruderNumberText
  26. anchors.centerIn: parent
  27. text: index + 1;
  28. font: UM.Theme.getFont("default_bold")
  29. }
  30. // Material colour circle
  31. // Only draw the filling colour of the material inside the SVG border.
  32. Rectangle
  33. {
  34. id: materialColorCircle
  35. anchors
  36. {
  37. right: parent.right
  38. }
  39. width: Math.round(parent.width * 0.35)
  40. height: Math.round(parent.height * 0.35)
  41. radius: Math.round(width / 2)
  42. border.width: UM.Theme.getSize("default_lining").width
  43. border.color: UM.Theme.getColor("extruder_button_material_border")
  44. opacity: !extruderIconItem.checked ? 0.6 : 1.0
  45. }
  46. }