summaryrefslogtreecommitdiffstats
path: root/src/sql/models/qsqlrelationaltablemodel.cpp
diff options
context:
space:
mode:
authorMark Brand <mabrand@mabrand.nl>2011-07-11 14:41:00 +0200
committerQt by Nokia <qt-info@nokia.com>2012-02-07 22:05:51 +0100
commit763d0a55e912689f2c0cbad41e81cdc3dbf402d0 (patch)
tree722646e0879737a5006ebe1924732e5fc3bb7839 /src/sql/models/qsqlrelationaltablemodel.cpp
parent1247683d40c3fbb4b7ce50cc5361e2398b45875e (diff)
QSqlTableModelPrivate::ModifiedRow guard private data
Even though ModifiedRow is not part of the public API, guarding its data helps make clear the intended patterns of use. "op" and "primaryValues" are read-only after construction. setValue() encourages maintainers to let ModifiedRow manage the "generated" flags of the record. The primeInsert() signal still exposes the actual record, including the "generated" flags, which is the justification for recRef(). Change-Id: I16d1610a8f9233af78b90662b08706b48ea19c41 Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
Diffstat (limited to 'src/sql/models/qsqlrelationaltablemodel.cpp')
-rw-r--r--src/sql/models/qsqlrelationaltablemodel.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/sql/models/qsqlrelationaltablemodel.cpp b/src/sql/models/qsqlrelationaltablemodel.cpp
index 3a8c12085f..75bf3ebe43 100644
--- a/src/sql/models/qsqlrelationaltablemodel.cpp
+++ b/src/sql/models/qsqlrelationaltablemodel.cpp
@@ -438,9 +438,9 @@ QVariant QSqlRelationalTableModel::data(const QModelIndex &index, int role) cons
//already have the correct display value.
if (d->strategy != OnFieldChange) {
const QSqlTableModelPrivate::ModifiedRow row = d->cache.value(index.row());
- if (row.op != QSqlTableModelPrivate::None && row.rec.isGenerated(index.column())) {
- if (d->strategy == OnManualSubmit || row.op != QSqlTableModelPrivate::Delete) {
- QVariant v = row.rec.value(index.column());
+ if (row.op() != QSqlTableModelPrivate::None && row.rec().isGenerated(index.column())) {
+ if (d->strategy == OnManualSubmit || row.op() != QSqlTableModelPrivate::Delete) {
+ QVariant v = row.rec().value(index.column());
if (v.isValid())
return relation.dictionary[v.toString()];
}