Keep material selected when editing its name, brand or type

Editing a material name, brand or type may change its position in the materials list. We now reselect the material after editing one of these values.
This commit is contained in:
fieldOfView 2017-05-08 11:36:18 +02:00
parent b4f56d10d7
commit 836cf27266
2 changed files with 13 additions and 2 deletions

View file

@ -82,7 +82,11 @@ TabView
width: scrollView.columnWidth;
text: properties.supplier;
readOnly: !base.editingEnabled;
onEditingFinished: base.setMetaDataEntry("brand", properties.supplier, text)
onEditingFinished:
{
base.setMetaDataEntry("brand", properties.supplier, text);
pane.objectList.currentIndex = pane.getIndexById(base.containerId);
}
}
Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Material Type") }
@ -91,7 +95,11 @@ TabView
width: scrollView.columnWidth;
text: properties.material_type;
readOnly: !base.editingEnabled;
onEditingFinished: base.setMetaDataEntry("material", properties.material_type, text)
onEditingFinished:
{
base.setMetaDataEntry("material", properties.material_type, text);
pane.objectList.currentIndex = pane.getIndexById(base.containerId)
}
}
Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Color") }
@ -419,6 +427,7 @@ TabView
Cura.ContainerManager.setContainerName(base.containerId, new_value);
// update material name label. not so pretty, but it works
materialProperties.name = new_value;
pane.objectList.currentIndex = pane.getIndexById(base.containerId)
}
}
}

View file

@ -227,6 +227,8 @@ UM.ManagementPage
properties: materialProperties
containerId: base.currentItem != null ? base.currentItem.id : ""
property alias pane: base
}
QtObject