cacheIndex = insert.cacheIndex + insert.count;
}
}
- for (; cacheIndex < m_cache.count(); ++cacheIndex)
- incrementIndexes(m_cache.at(cacheIndex), m_groupCount, inserted);
+ for (const QList<QQmlDelegateModelItem *> cache = m_cache; cacheIndex < cache.count(); ++cacheIndex)
+ incrementIndexes(cache.at(cacheIndex), m_groupCount, inserted);
}
void QQmlDelegateModelPrivate::itemsInserted(const QVector<Compositor::Insert> &inserts)
d->m_count += count;
- for (int i = 0, c = d->m_cache.count(); i < c; ++i) {
- QQmlDelegateModelItem *item = d->m_cache.at(i);
+ const QList<QQmlDelegateModelItem *> cache = d->m_cache;
+ for (int i = 0, c = cache.count(); i < c; ++i) {
+ QQmlDelegateModelItem *item = cache.at(i);
if (item->modelIndex() >= index)
item->setModelIndex(item->modelIndex() + count);
}
}
}
- for (; cacheIndex < m_cache.count(); ++cacheIndex)
- incrementIndexes(m_cache.at(cacheIndex), m_groupCount, removed);
+ for (const QList<QQmlDelegateModelItem *> cache = m_cache; cacheIndex < cache.count(); ++cacheIndex)
+ incrementIndexes(cache.at(cacheIndex), m_groupCount, removed);
}
void QQmlDelegateModelPrivate::itemsRemoved(const QVector<Compositor::Remove> &removes)
return;
d->m_count -= count;
-
- for (int i = 0, c = d->m_cache.count(); i < c; ++i) {
- QQmlDelegateModelItem *item = d->m_cache.at(i);
+ const QList<QQmlDelegateModelItem *> cache = d->m_cache;
+ for (int i = 0, c = cache.count(); i < c; ++i) {
+ QQmlDelegateModelItem *item = cache.at(i);
if (item->modelIndex() >= index + count)
item->setModelIndex(item->modelIndex() - count);
else if (item->modelIndex() >= index)
const int maximum = qMax(from, to) + count;
const int difference = from > to ? count : -count;
- for (int i = 0, c = d->m_cache.count(); i < c; ++i) {
- QQmlDelegateModelItem *item = d->m_cache.at(i);
+ const QList<QQmlDelegateModelItem *> cache = d->m_cache;
+ for (int i = 0, c = cache.count(); i < c; ++i) {
+ QQmlDelegateModelItem *item = cache.at(i);
if (item->modelIndex() >= from && item->modelIndex() < from + count)
item->setModelIndex(item->modelIndex() - from + to);
else if (item->modelIndex() >= minimum && item->modelIndex() < maximum)
if (d->m_complete) {
d->m_count = d->m_adaptorModel.count();
- for (int i = 0, c = d->m_cache.count(); i < c; ++i) {
- QQmlDelegateModelItem *item = d->m_cache.at(i);
+ const QList<QQmlDelegateModelItem *> cache = d->m_cache;
+ for (int i = 0, c = cache.count(); i < c; ++i) {
+ QQmlDelegateModelItem *item = cache.at(i);
if (item->modelIndex() != -1)
item->setModelIndex(-1);
}