Skip to content

Commit 847afc3

Browse files
Copy-Paste under ProxyModel (#69)
Fixed a problem with the invalidation of cells and with copy paste as we are now using a proxy model.
1 parent 0bd5333 commit 847afc3

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/petab_gui/models/pandas_table_model.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ def reset_invalid_cells(self):
364364
for row, col in invalid_cells:
365365
index = self.index(row, col)
366366
self.dataChanged.emit(index, index, [Qt.BackgroundRole])
367+
367368
def mimeData(self, rectangle, start_index):
368369
"""Return the data to be copied to the clipboard.
369370
@@ -660,3 +661,15 @@ def filterAcceptsRow(self, source_row, source_parent):
660661
if regex.match(data_str).hasMatch():
661662
return True
662663
return False # No match found
664+
665+
def mimeData(self, rectangle, start_index):
666+
"""Return the data to be copied to the clipboard."""
667+
return self.source_model.mimeData(rectangle, start_index)
668+
669+
def setDataFromText(self, text, start_row, start_column):
670+
"""Set the data from text."""
671+
return self.source_model.setDataFromText(text, start_row, start_column)
672+
673+
@property
674+
def _invalid_cells(self):
675+
return self.source_model._invalid_cells

0 commit comments

Comments
 (0)