summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-03-01 06:32:35 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-03-01 06:32:35 (GMT)
commit049330b4a54836f227a0e179082527a5272e868d (patch)
treeb33ce32ee9b86c4c6bf2e87cfd1c6d6f61bf2e2c /src
parentd5449c3cc85624b50e6a6fcabc6ad96b79d4bd0a (diff)
parentfa7053103f4aa528972dc8766c05b5a1371b2bd8 (diff)
downloadQt-049330b4a54836f227a0e179082527a5272e868d.zip
Qt-049330b4a54836f227a0e179082527a5272e868d.tar.gz
Qt-049330b4a54836f227a0e179082527a5272e868d.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml
Conflicts: demos/declarative/flickr/mobile/ImageDetails.qml
Diffstat (limited to 'src')
-rw-r--r--src/declarative/util/qdeclarativexmllistmodel.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp
index 386df46..162a669 100644
--- a/src/declarative/util/qdeclarativexmllistmodel.cpp
+++ b/src/declarative/util/qdeclarativexmllistmodel.cpp
@@ -709,8 +709,24 @@ void QDeclarativeXmlListModel::reload()
d->qmlXmlQuery.abort();
d->queryId = -1;
- if (d->size < 0)
+ int count = d->size;
+ if (count < 0)
d->size = 0;
+ bool hasKeys = false;
+ for (int i=0; i<d->roleObjects.count(); i++) {
+ if (d->roleObjects[i]->isKey()) {
+ hasKeys = true;
+ break;
+ }
+ }
+ if (!hasKeys) {
+ d->data.clear();
+ d->size = 0;
+ if (count > 0) {
+ emit itemsRemoved(0, count);
+ emit countChanged();
+ }
+ }
if (d->src.isEmpty() && d->xml.isEmpty())
return;
@@ -782,9 +798,10 @@ void QDeclarativeXmlListModel::queryCompleted(int id, int size)
d->data = d->qmlXmlQuery.modelData();
QList<QDeclarativeXmlListRange> removed = d->qmlXmlQuery.removedItemRanges();
+ QList<QDeclarativeXmlListRange> inserted = d->qmlXmlQuery.insertedItemRanges();
+
for (int i=0; i<removed.count(); i++)
emit itemsRemoved(removed[i].first, removed[i].second);
- QList<QDeclarativeXmlListRange> inserted = d->qmlXmlQuery.insertedItemRanges();
for (int i=0; i<inserted.count(); i++)
emit itemsInserted(inserted[i].first, inserted[i].second);