summaryrefslogtreecommitdiffstats
path: root/src/sql
diff options
context:
space:
mode:
authorAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-11-11 09:33:57 (GMT)
committerAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-11-11 09:33:57 (GMT)
commit6855df6110eebdbfc43211f20dd65f446ccda209 (patch)
treedd731afb046463a7dcbe249f7ea9de0484195b2a /src/sql
parent835a23891567831cf184e5bbaba8d00bfc912699 (diff)
parent95db13345cd7b6b7cac8725fe2879aaf80233818 (diff)
downloadQt-6855df6110eebdbfc43211f20dd65f446ccda209.zip
Qt-6855df6110eebdbfc43211f20dd65f446ccda209.tar.gz
Qt-6855df6110eebdbfc43211f20dd65f446ccda209.tar.bz2
Merge remote branch 'qt/4.6' into kinetic-declarativeui
Diffstat (limited to 'src/sql')
-rw-r--r--src/sql/models/qsqlquerymodel.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/sql/models/qsqlquerymodel.cpp b/src/sql/models/qsqlquerymodel.cpp
index 1719239..319055e 100644
--- a/src/sql/models/qsqlquerymodel.cpp
+++ b/src/sql/models/qsqlquerymodel.cpp
@@ -314,6 +314,7 @@ void QSqlQueryModel::setQuery(const QSqlQuery &query)
QSqlRecord newRec = query.record();
bool columnsChanged = (newRec != d->rec);
bool hasQuerySize = query.driver()->hasFeature(QSqlDriver::QuerySize);
+ bool hasNewData = (newRec != QSqlRecord()) || !query.lastError().isValid();
if (d->colOffsets.size() != newRec.count() || columnsChanged)
d->initColOffsets(newRec.count());
@@ -328,13 +329,13 @@ void QSqlQueryModel::setQuery(const QSqlQuery &query)
d->error = QSqlError();
d->query = query;
d->rec = newRec;
-
+
if (mustClearModel)
endRemoveRows();
-
- d->atEnd = false;
- if (columnsChanged)
+ d->atEnd = false;
+
+ if (columnsChanged && hasNewData)
reset();
if (!query.isActive() || query.isForwardOnly()) {