diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-04-07 01:53:16 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-04-07 02:38:42 (GMT) |
commit | 973cfce37fcdd1ce330f237eaa76930db55a73f6 (patch) | |
tree | 96480cb291d6e5d2e0a9bf78bf1127a693ab2930 /src/declarative/util | |
parent | 32fdd579afc2933ccc5fc658553cf18cf2057ff2 (diff) | |
download | Qt-973cfce37fcdd1ce330f237eaa76930db55a73f6.zip Qt-973cfce37fcdd1ce330f237eaa76930db55a73f6.tar.gz Qt-973cfce37fcdd1ce330f237eaa76930db55a73f6.tar.bz2 |
Add QListModelInterface::modelReset() signal and emit this in
XmlListModel when all data has changed.
Diffstat (limited to 'src/declarative/util')
-rw-r--r-- | src/declarative/util/qdeclarativexmllistmodel.cpp | 25 | ||||
-rw-r--r-- | src/declarative/util/qdeclarativexmllistmodel_p.h | 1 |
2 files changed, 14 insertions, 12 deletions
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index b33af06..11c7305 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -878,21 +878,22 @@ void QDeclarativeXmlListModel::queryCompleted(const QDeclarativeXmlQueryResult & } } if (!hasKeys) { - if (!(origCount == 0 && d->size == 0)) { - emit itemsRemoved(0, origCount); - emit itemsInserted(0, d->size); - emit countChanged(); - } + if (!(origCount == 0 && d->size == 0)) + emit modelReset(); } else { + if (result.removed.count() == 1 && result.removed[0].first == 0 + && result.removed[0].second == origCount) { + emit modelReset(); + } else { + for (int i=0; i<result.removed.count(); i++) + emit itemsRemoved(result.removed[i].first, result.removed[i].second); + for (int i=0; i<result.inserted.count(); i++) + emit itemsInserted(result.inserted[i].first, result.inserted[i].second); - for (int i=0; i<result.removed.count(); i++) - emit itemsRemoved(result.removed[i].first, result.removed[i].second); - for (int i=0; i<result.inserted.count(); i++) - emit itemsInserted(result.inserted[i].first, result.inserted[i].second); - - if (sizeChanged) - emit countChanged(); + if (sizeChanged) + emit countChanged(); + } } emit statusChanged(d->status); diff --git a/src/declarative/util/qdeclarativexmllistmodel_p.h b/src/declarative/util/qdeclarativexmllistmodel_p.h index 7b85476..fd410a7 100644 --- a/src/declarative/util/qdeclarativexmllistmodel_p.h +++ b/src/declarative/util/qdeclarativexmllistmodel_p.h @@ -124,6 +124,7 @@ Q_SIGNALS: void xmlChanged(); void queryChanged(); void namespaceDeclarationsChanged(); + void modelReset(); public Q_SLOTS: // ### need to use/expose Expiry to guess when to call this? |