MachineSelectorList.qml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 2.3
  5. import UM 1.2 as UM
  6. import Cura 1.0 as Cura
  7. ListView
  8. {
  9. id: listView
  10. model: Cura.GlobalStacksModel {}
  11. section.property: "hasRemoteConnection"
  12. property real contentHeight: childrenRect.height
  13. section.delegate: Label
  14. {
  15. text: section == "true" ? catalog.i18nc("@label", "Connected printers") : catalog.i18nc("@label", "Preset printers")
  16. width: parent.width
  17. height: UM.Theme.getSize("action_button").height
  18. leftPadding: UM.Theme.getSize("default_margin").width
  19. renderType: Text.NativeRendering
  20. font: UM.Theme.getFont("medium")
  21. color: UM.Theme.getColor("text_medium")
  22. verticalAlignment: Text.AlignVCenter
  23. }
  24. delegate: MachineSelectorButton
  25. {
  26. text: model.name ? model.name : ""
  27. width: listView.width
  28. outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
  29. checked: Cura.MachineManager.activeMachine ? Cura.MachineManager.activeMachine.id == model.id : false
  30. onClicked:
  31. {
  32. toggleContent()
  33. Cura.MachineManager.setActiveMachine(model.id)
  34. }
  35. }
  36. }