Solved Remove row while model (QSqlRelationalTableModel) is dirty
-
I add a new row in my model (QSqlRelationalTableModel).
So, it's dirty (model ->dirty returns true) . (EditStrategy is OnManualSubmit)If I want to cancel the new record and delete it from the model while it is dirty, what should I do?
I tried:
model->removeRow(model->rowCount());
but fails, the row is not removed from model.
-
I replaced:
model->rowCount()
with:
mapper->currentIndex()
and seems to work.
-
But the model>isDirty() remains true...
How can I make it become false?
I tried:mapper->submit(); model->submitAll(); model->submit();
but they fail.
EDIT: model->revertAll() seems to set isDirty to false.