mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
geometry: Profile: Fix delete command undo point order.
This commit is contained in:
1 parent
b3a6d0713d
commit
ff9c47eb83
4 files changed
+42
-15
No files matched your search
@@ -69,18 +69,15 @@ class DelCommand(QUndoCommand):
|
||||
|
||||
self._points = []
|
||||
for row in rows:
|
||||
self._points.append(self._profile.point(row))
|
||||
self._points.reverse()
|
||||
self._points.append((row, self._profile.point(row)))
|
||||
self._points.sort() # Sort by row index
|
||||
|
||||
def undo(self):
|
||||
row = self._rows[0]
|
||||
for point in self._points:
|
||||
for row, point in self._points:
|
||||
self._profile.insert_point(row, point)
|
||||
|
||||
def redo(self):
|
||||
row = self._rows[0]
|
||||
for _ in self._rows:
|
||||
self._profile.delete(row)
|
||||
self._profile.delete(self._rows)
|
||||
|
||||
class SortCommand(QUndoCommand):
|
||||
def __init__(self, profile, column, _reverse):
|
||||
|
||||
@@ -201,7 +201,7 @@ class TableEditableModel(QAbstractTableModel):
|
||||
self.layoutChanged.emit()
|
||||
|
||||
def remove_rows(self, rows, parent=QModelIndex()):
|
||||
self.beginRemoveRows(parent, rows[0], row[-1])
|
||||
self.beginRemoveRows(parent, rows[0], rows[-1])
|
||||
|
||||
self._undo_stack.push(
|
||||
DelCommand(
|
||||
|
||||
Reference in new issue
Block a user