diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-03-01 06:32:35 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-03-01 06:32:35 (GMT) |
commit | 049330b4a54836f227a0e179082527a5272e868d (patch) | |
tree | b33ce32ee9b86c4c6bf2e87cfd1c6d6f61bf2e2c /src | |
parent | d5449c3cc85624b50e6a6fcabc6ad96b79d4bd0a (diff) | |
parent | fa7053103f4aa528972dc8766c05b5a1371b2bd8 (diff) | |
download | Qt-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.cpp | 21 |
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); |