mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Pollutants: fix deletion, didnt work correctly due to relative / flat indexes
This commit is contained in:
1 parent
b6be245764
commit
1f5ce72fb2
1 file changed
+1
-5
@@ -110,14 +110,10 @@ class TableModel(PamhyrTableModel):
|
|||||||
def delete(self, rows, parent=QModelIndex()):
|
def delete(self, rows, parent=QModelIndex()):
|
||||||
self.beginRemoveRows(parent, rows[0], rows[-1])
|
self.beginRemoveRows(parent, rows[0], rows[-1])
|
||||||
|
|
||||||
data_rows = {
|
|
||||||
id(pol): i for i, pol in enumerate(self._data._Pollutants._lst)
|
|
||||||
}
|
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
DelCommand(
|
DelCommand(
|
||||||
self._data._Pollutants,
|
self._data._Pollutants,
|
||||||
[data_rows[id(self._lst[row])] for row in rows
|
[row for row in rows if 0 <= row < len(self._lst)],
|
||||||
if 0 <= row < len(self._lst)],
|
|
||||||
self._data.ic_adists
|
self._data.ic_adists
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in new issue
Block a user