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>
This commit is contained in:
Mark Brand 2012-02-08 09:38:05 +01:00 committed by Qt by Nokia
parent 678d56ccf1
commit f5e58a1f69

View File

@ -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;
}
/*!