summaryrefslogtreecommitdiffstats
path: root/src/sql/models
diff options
context:
space:
mode:
authorMark Brand <mabrand@mabrand.nl>2012-02-08 09:38:05 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-08 14:43:18 +0100
commitf5e58a1f69e5d17369198bbf1e7bb8946e3c7b5d (patch)
tree22c2b23f27c1ced8a84cf152bd9cacb830f113c6 /src/sql/models
parent678d56ccf1e6970c2cfe149b99f080ec1002c89f (diff)
QSqlTableModel::setData(): submit() instead of updateRowInTable()
Use submit() instead of calling updatRowInTable(). The effect is exactly the same. Submit() invokes submitAll() which invokes updateRowInTable(). The cache is purged and select() is called only on success. Change-Id: I3de9a3d6acf802ee6594d034a9e261e53637995d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Diffstat (limited to 'src/sql/models')
-rw-r--r--src/sql/models/qsqltablemodel.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp
index 38705c70a9..1746883d34 100644
--- a/src/sql/models/qsqltablemodel.cpp
+++ b/src/sql/models/qsqltablemodel.cpp
@@ -508,17 +508,10 @@ bool QSqlTableModel::setData(const QModelIndex &index, const QVariant &value, in
row.setValue(index.column(), value);
emit dataChanged(index, index);
- bool isOk = true;
- if (d->strategy == OnFieldChange && row.op() != QSqlTableModelPrivate::Insert) {
- // historical bug: bad style to call updateRowInTable.
- // Should call submit(), but maybe the author wanted to avoid
- // clearing the cache on failure.
- isOk = updateRowInTable(index.row(), row.rec());
- if (isOk)
- select();
- }
+ if (d->strategy == OnFieldChange && row.op() != QSqlTableModelPrivate::Insert)
+ return submit();
- return isOk;
+ return true;
}
/*!