summaryrefslogtreecommitdiffstats
path: root/src/sql
diff options
context:
space:
mode:
Diffstat (limited to 'src/sql')
-rw-r--r--src/sql/models/qsqltablemodel.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp
index 9e1cfe3051..35346c0f83 100644
--- a/src/sql/models/qsqltablemodel.cpp
+++ b/src/sql/models/qsqltablemodel.cpp
@@ -1079,8 +1079,11 @@ bool QSqlTableModel::insertRecord(int row, const QSqlRecord &record)
row = rowCount();
if (!insertRow(row, QModelIndex()))
return false;
- if (!setRecord(row, record))
+ if (!setRecord(row, record)) {
+ if (d->strategy == OnManualSubmit)
+ revertRow(row);
return false;
+ }
if (d->strategy == OnFieldChange || d->strategy == OnRowChange)
return submit();
return true;