Question

I use QSqlTableModel with OnManualSubmit edit strategy.
I have possibility to revert changes for some row with revertRow() method.
But how can I submit only one row of table? I have only submitAll() method.
I could use insertRowIntoTable(), but it is protected and I don't want to inherit QSqlTableModel.

Was it helpful?

Solution

I could save the data from all dirty cells to some QMap.
Then call revertAll(), insert new rows into model and call submitAll().
And then copy unsaved data from the list back to the model.
But this solution is very ugly :( It seems that the only way is to inherit QSqlTableModel and to use insertRowIntoTable().

UPD. I have tried insertRowIntoTable(), unfortunately it inserts row into DB but not into model :(

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top