BC: Edit: Add paste feature.

This commit is contained in:
Pierre-Antoine Rouby committed 2023-05-04 15:18:42 +02:00
1 parent f8355021e7
commit fff5668afe
4 files changed
+66 -8

No files matched your search

+22
View File
@@ -162,6 +162,28 @@ class TableModel(QAbstractTableModel):
self.endMoveRows()
self.layoutChanged.emit()
def paste(self, row, header, data):
if len(data) == 0:
return
self.layoutAboutToBeChanged.emit()
self._undo.push(
PasteCommand(
self._data, row,
list(
map(
lambda d: self._data.new_from_data(header, d),
data
)
)
)
)
self.layoutAboutToBeChanged.emit()
self.layoutChanged.emit()
def undo(self):
self._undo.undo()
self.layoutChanged.emit()