Make SidebarHeader use ExtrudersModel

This model is also used by the extruder selection drop-downs, and it's automatically filled already so that was double logic.

Contributes to issues CURA-340 and CURA-1278.
This commit is contained in:
Ghostkeeper 2016-06-08 16:00:52 +02:00
parent 2d998c127b
commit 7dbafa06d1
No known key found for this signature in database
GPG key ID: 701948C5954A7385

View file

@ -104,7 +104,7 @@ Item
anchors.leftMargin: model.index * (extruderSelection.width / machineExtruderCount.properties.value)
anchors.verticalCenter: parent.verticalCenter
width: parent.width / machineExtruderCount.properties.value
text: model.text
text: model.name
exclusiveGroup: extruderMenuGroup;
checkable: true;
checked: base.currentExtruderIndex == index
@ -138,10 +138,11 @@ Item
}
}
ExclusiveGroup { id: extruderMenuGroup; }
ListView{
ListView
{
id: extrudersList
property var index: 0
model: extrudersListModel
model: Cura.ExtrudersModel {}
delegate: wizardDelegate
anchors.top: parent.top
anchors.left: parent.left
@ -149,28 +150,6 @@ Item
}
}
ListModel
{
id: extrudersListModel
Component.onCompleted: populateExtruderModel()
}
Connections
{
id: machineChange
target: Cura.MachineManager
onGlobalContainerChanged: populateExtruderModel()
}
function populateExtruderModel()
{
extrudersListModel.clear();
for(var extruder = 0; extruder < machineExtruderCount.properties.value ; extruder++) {
extrudersListModel.append({
text: catalog.i18nc("@label", "Extruder %1").arg(extruder + 1)
})
}
}
Rectangle {
id: variantRow
anchors.top: extruderSelection.visible ? extruderSelection.bottom : machineSelectionRow.bottom