aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types/qqmldelegatemodel.cpp
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@crimson.no>2017-01-16 21:36:27 +0100
committerRobin Burchell <robin.burchell@crimson.no>2017-01-17 21:39:58 +0000
commit7ed968be5564d8c19d918a3ce8e0683c162f4f1b (patch)
tree4f93e7ac2b51f00e2c2f6ae973cd59a0e97224e9 /src/qml/types/qqmldelegatemodel.cpp
parentf88ac80a28467648f5e0c5c3d7dc978c4967af4c (diff)
qml: Remove last foreach, and mark QT_NO_FOREACH
Just src/imports/ to go... Change-Id: Ib4484676e24655cb950b3c4bb6495ff0e7f9700f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/types/qqmldelegatemodel.cpp')
-rw-r--r--src/qml/types/qqmldelegatemodel.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp
index c635ccf79c..c0d75cae33 100644
--- a/src/qml/types/qqmldelegatemodel.cpp
+++ b/src/qml/types/qqmldelegatemodel.cpp
@@ -264,7 +264,7 @@ QQmlDelegateModel::~QQmlDelegateModel()
{
Q_D(QQmlDelegateModel);
- foreach (QQmlDelegateModelItem *cacheItem, d->m_cache) {
+ for (QQmlDelegateModelItem *cacheItem : qAsConst(d->m_cache)) {
if (cacheItem->object) {
delete cacheItem->object;
@@ -764,7 +764,8 @@ void QQmlDelegateModelPrivate::updateFilterGroup()
emit q->countChanged();
if (m_parts) {
- foreach (QQmlPartsModel *model, m_parts->models)
+ auto partsCopy = m_parts->models; // deliberate; this may alter m_parts
+ for (QQmlPartsModel *model : qAsConst(partsCopy))
model->updateFilterGroup(m_compositorGroup, changeSet);
}
}
@@ -1472,7 +1473,8 @@ void QQmlDelegateModelPrivate::emitChanges()
for (int i = 1; i < m_groupCount; ++i)
QQmlDelegateModelGroupPrivate::get(m_groups[i])->emitModelUpdated(reset);
- foreach (QQmlDelegateModelItem *cacheItem, m_cache) {
+ auto cacheCopy = m_cache; // deliberate; emitChanges may alter m_cache
+ for (QQmlDelegateModelItem *cacheItem : qAsConst(cacheCopy)) {
if (cacheItem->attached)
cacheItem->attached->emitChanges();
}