]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Use mutable iterators where required
authorAlexander Lohnau <alexander.lohnau@gmx.de>
Sat, 24 Oct 2020 14:46:34 +0000 (16:46 +0200)
committerAlexander Lohnau <alexander.lohnau@gmx.de>
Sat, 24 Oct 2020 14:46:34 +0000 (16:46 +0200)
src/kitemviews/kfileitemmodel.cpp
src/kitemviews/kfileitemmodelrolesupdater.cpp
src/kitemviews/kitemlistview.cpp

index b89fe4f58e3de05008625ddbc34b2d55632fdd9b..08407d1efb047cd1c9a1cbc66b2c8023afb2c5d6 100644 (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);
index b9c6ccd29526d26cea1f3fa65f9574f162015120..8f3ddceed86858bbb96967cafca4f55a788359ba 100644 (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) {
index 3103012a99ddf613b0e92e3fc3f06f3662833f57..4ed0d7ba4264121a988d30ed037c42d9b79fe2ab 100644 (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;