[bugfix] Sorting items before removing them from list

The selectedIndexes are now sorted before the are removed from the listView. Otherwise you get problems with indices that aren't in descending order.
This commit is contained in:
Sally 2019-03-21 12:37:09 +01:00
parent 02900d8c9d
commit bcc5055ef3

View File

@ -308,7 +308,7 @@ class AddMetadataWidget(QWidget):
also adds the path to the list of inventories that get deleted upon accepting all changes or deletes the also adds the path to the list of inventories that get deleted upon accepting all changes or deletes the
path from the list of of inventories that get added to the metadata upon accepting all changes path from the list of of inventories that get added to the metadata upon accepting all changes
""" """
for index in reversed(self.list_view.selectionModel().selectedIndexes()): for index in reversed(sorted(self.list_view.selectionModel().selectedIndexes())):
item = self.list_model.itemData(index) item = self.list_model.itemData(index)
inventory_path = item[0] # marked path inventory_path = item[0] # marked path
self.list_model.removeRow(index.row()) # aus der Anzeige-Liste gelöscht self.list_model.removeRow(index.row()) # aus der Anzeige-Liste gelöscht