Select the activated material when material management page shows up

CURA-4606
This commit is contained in:
Lipu Fei 2018-03-06 11:55:20 +01:00
parent 27b3a71a98
commit ff0d694e72

View file

@ -52,6 +52,24 @@ Item
return base.currentItem.root_material_id == root_material_id;
}
Component.onCompleted:
{
// Select the activated material when this page shows up
const extruder_position = Cura.ExtruderManager.activeExtruderIndex;
const active_root_material_id = Cura.MachineManager.currentRootMaterialId[extruder_position];
var itemIndex = -1;
for (var i = 0; i < materialsModel.rowCount(); ++i)
{
var item = materialsModel.getItem(i);
if (item.root_material_id == active_root_material_id)
{
itemIndex = i;
break;
}
}
materialListView.currentIndex = itemIndex;
}
Row // Button Row
{
id: buttonRow