diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-04-08 03:09:57 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-04-08 03:15:58 (GMT) |
commit | dcce90c4d9c8d010d7fc45c33048ff00e468b89c (patch) | |
tree | a5878939ae54e98102acb6c97619b996d3959655 /src/declarative/util | |
parent | 5d9f5b0ba76bee4b148e13fd880d87d167e6c68d (diff) | |
download | Qt-dcce90c4d9c8d010d7fc45c33048ff00e468b89c.zip Qt-dcce90c4d9c8d010d7fc45c33048ff00e468b89c.tar.gz Qt-dcce90c4d9c8d010d7fc45c33048ff00e468b89c.tar.bz2 |
Revert "Add QListModelInterface::modelReset() signal and emit this in"
This reverts commit 973cfce37fcdd1ce330f237eaa76930db55a73f6.
Need more consideration before adding modelReset(). For example if
item insertion/removal is supposed to trigger animations through
added/removed signals, they won't be triggered if only the modelReset()
signal is emitted. Also if we add modelReset(), it should also be
implemented for ListModel to make sure it is implemented by all subclasses
of QListModelInterface and to test the impact of this on the view classes.
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, 12 insertions, 14 deletions
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index 11c7305..b33af06 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -878,22 +878,21 @@ void QDeclarativeXmlListModel::queryCompleted(const QDeclarativeXmlQueryResult & } } if (!hasKeys) { - if (!(origCount == 0 && d->size == 0)) - emit modelReset(); + if (!(origCount == 0 && d->size == 0)) { + emit itemsRemoved(0, origCount); + emit itemsInserted(0, d->size); + emit countChanged(); + } } 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); - if (sizeChanged) - emit countChanged(); - } + 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(); } emit statusChanged(d->status); diff --git a/src/declarative/util/qdeclarativexmllistmodel_p.h b/src/declarative/util/qdeclarativexmllistmodel_p.h index fd410a7..7b85476 100644 --- a/src/declarative/util/qdeclarativexmllistmodel_p.h +++ b/src/declarative/util/qdeclarativexmllistmodel_p.h @@ -124,7 +124,6 @@ Q_SIGNALS: void xmlChanged(); void queryChanged(); void namespaceDeclarationsChanged(); - void modelReset(); public Q_SLOTS: // ### need to use/expose Expiry to guess when to call this? |