summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dist/changes-5.0.02
-rw-r--r--src/sql/models/qsqltablemodel.cpp5
2 files changed, 6 insertions, 1 deletions
diff --git a/dist/changes-5.0.0 b/dist/changes-5.0.0
index 996bdf4b0b..7726843ccb 100644
--- a/dist/changes-5.0.0
+++ b/dist/changes-5.0.0
@@ -355,6 +355,8 @@ ignore the rest of the range.
is consistent with the meaning of the flag.
-Require all fields to map correctly. Previously fields that didn't
map were simply ignored.
+ -For OnManualSubmit, insertRecord() no longer leaves behind an empty
+ row if setRecord() fails.
****************************************************************************
* Database Drivers *
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;