ExtruderButton.qml 940 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright (c) 2017 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.2 as UM
  6. import Cura 1.0 as Cura
  7. Cura.ToolbarButton
  8. {
  9. id: base
  10. property var extruder
  11. text: catalog.i18ncp("@label %1 is filled in with the name of an extruder", "Print Selected Model with %1", "Print Selected Models with %1", UM.Selection.selectionCount).arg(extruder.name)
  12. checked: Cura.ExtruderManager.selectedObjectExtruders.indexOf(extruder.id) != -1
  13. enabled: UM.Selection.hasSelection && extruder.stack.isEnabled
  14. toolItem: ExtruderIcon
  15. {
  16. materialColor: extruder.color
  17. extruderEnabled: extruder.stack.isEnabled
  18. property int index: extruder.index
  19. }
  20. onClicked:
  21. {
  22. forceActiveFocus() //First grab focus, so all the text fields are updated
  23. CuraActions.setExtruderForSelection(extruder.id)
  24. }
  25. }