Use mutable iterators where required

This commit is contained in:
Alexander Lohnau 2020-10-24 16:46:34 +02:00
parent 97415729c3
commit 2448f88c5f
3 changed files with 10 additions and 3 deletions

View file

@ -917,7 +917,9 @@ void KFileItemModel::slotCompleted()
// Note that the parent folder must be expanded before any of its subfolders become visible.
// Therefore, some URLs in m_restoredExpandedUrls might not be visible yet
// -> we expand the first visible URL we find in m_restoredExpandedUrls.
for (const QUrl& url : qAsConst(m_urlsToExpand)) {
QMutableSetIterator<QUrl> it(m_urlsToExpand);
while (it.hasNext()) {
const QUrl url = it.next();
const int indexForUrl = index(url);
if (indexForUrl >= 0) {
m_urlsToExpand.remove(url);

View file

@ -943,7 +943,9 @@ void KFileItemModelRolesUpdater::updateChangedItems()
QList<int> visibleChangedIndexes;
QList<int> invisibleChangedIndexes;
for (const KFileItem& item : qAsConst(m_changedItems)) {
QMutableSetIterator<KFileItem> it(m_changedItems);
while (it.hasNext()) {
const KFileItem item = it.next();
const int index = m_model->index(item);
if (index < 0) {

View file

@ -1155,7 +1155,10 @@ void KItemListView::slotItemsRemoved(const KItemRangeList& itemRanges)
QVector<int> itemsToMove;
// Remove all KItemListWidget instances that got deleted
for (KItemListWidget* widget : qAsConst(m_visibleItems)) {
QMutableHashIterator<int, KItemListWidget*> it(m_visibleItems);
while (it.hasNext()) {
it.next();
KItemListWidget* widget = it.value();
const int i = widget->index();
if (i < firstRemovedIndex) {
continue;