How to reimplement removeRows in Tableview model
-
Hello,
I'm displaying data in a QTableView, the data is stored in a model subclassed from QAbstractTableModel.
I'm trying to reimplement removeRows method to remove given rows from my table.
here's what I tried so far:
def removeRows(self, row:int, count:int, parent=None): self.beginRemoveRows(parent, row, row+count) self._items = self._items[:row] + self._items[row+count+1:] self.endRemoveRows() return True
self._items
is a list of lists that contains all my rows.the function returns an error for the moment at the first line of the code:
beginRemoveRows
doesn't like theNone
parent.What I'm doing wrong ?
Thanks,
FIXED:
parent = QtCore.QModelIndex() instead of None.