I am new to PyQt5, I am working with a QTableView. After successfuly knew how te delete selected rows.. I have googled a lot to know ho to undelete a selected deleted row from the table (& by sequence from the TableModel) with no result...
So far, I could know if the row is marked deleted based on the header data:
if self.items_Model.itemsModel.headerData(row.row(), QtCore.Qt.Vertical) == "!":
# self.items_Model.itemsModel.revertRow(row.row())
self.items_Model.itemsModel.selectRow(row.row())
I tried revertRow(rowIndex) and selectRow() but these methods repopulate the row from the database and does not remove the flag "!"; meaning - as I supposed - that on Submit, it will be deleted.
Please, any help.
It's weird that nobody here had answered my question...
After several tries... Including closing the editor and relaunching it...
It appears that to return the row to its previous state - in this case "not marked deleted"- we must use the "revert" method. But the mark "!" does not change unless we remove focus of the row to be undeleted i.e. select another row.
this is the whole code of my delete method: