Cura/resources/qml/PrinterSelector/MachineSelectorList.qml
joeydelarago b18080c332 Rename AbstractStacksModel.py -> MachineListModel.py since this model includes both abstract machine stacks and regular machines
Add machineCount for displaying the number of machines of a type.

MachineSelectorButton is in use in other places, swapped it out for a new Component MachineListButton.

CURA-9514
2022-08-23 14:29:05 +02:00

43 lines
1.1 KiB
QML

// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Controls 2.3
import UM 1.5 as UM
import Cura 1.0 as Cura
ListView
{
id: listView
model: Cura.MachineListModel {}
section.property: "section"
property real contentHeight: childrenRect.height
ScrollBar.vertical: UM.ScrollBar
{
id: scrollBar
}
section.delegate: UM.Label
{
text: section == "true" ? catalog.i18nc("@label", "Connected printers") : catalog.i18nc("@label", "Preset printers")
width: parent.width - scrollBar.width
height: UM.Theme.getSize("action_button").height
leftPadding: UM.Theme.getSize("default_margin").width
font: UM.Theme.getFont("medium")
color: UM.Theme.getColor("text_medium")
}
delegate: MachineListButton
{
text: model.name ? model.name : ""
width: listView.width - scrollBar.width
onClicked:
{
toggleContent()
Cura.MachineManager.setActiveMachine(model.id)
}
}
}