summaryrefslogtreecommitdiffstats
path: root/src/imports/organizer/qdeclarativeorganizermodel.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2019-06-18 11:26:52 +0200
committerMarc Mutz <marc.mutz@kdab.com>2019-06-18 12:43:27 +0200
commit8fec622c186d254bc9750606d54c32670a9046a5 (patch)
tree69d50f4da0ede588dda33bcda82a7f6af8155cb6 /src/imports/organizer/qdeclarativeorganizermodel.cpp
parent0b4522ae19d560881fdf85e8762c0d7f28310d50 (diff)
Eradicate Java-style iterators and mark the module free of them
Java-style iterators are scheduled for deprecation, or at the very least banned from use in Qt code. Change-Id: I58491db446ecaba2007f7e3fb45a9784635391db Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
Diffstat (limited to 'src/imports/organizer/qdeclarativeorganizermodel.cpp')
-rw-r--r--src/imports/organizer/qdeclarativeorganizermodel.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/imports/organizer/qdeclarativeorganizermodel.cpp b/src/imports/organizer/qdeclarativeorganizermodel.cpp
index 98889f568..c191f37aa 100644
--- a/src/imports/organizer/qdeclarativeorganizermodel.cpp
+++ b/src/imports/organizer/qdeclarativeorganizermodel.cpp
@@ -1674,25 +1674,21 @@ void QDeclarativeOrganizerModel::collectionsFetched()
declCollections.insert(declCollection->collection().id().toString(), declCollection);
}
// go tables through
- QHashIterator<QString, const QOrganizerCollection*> collIterator(collections);
- while (collIterator.hasNext()) {
- collIterator.next();
- if (declCollections.contains(collIterator.key())) {
+ for (auto it = collections.cbegin(), end = collections.cend(); it != end; ++it) {
+ if (declCollections.contains(it.key())) {
// collection on both sides, update the declarative collection
- declCollections.value(collIterator.key())->setCollection(*collections.value(collIterator.key()));
+ declCollections.value(it.key())->setCollection(*it.value());
} else {
// new collection, add it to declarative collection list
QDeclarativeOrganizerCollection* declCollection = new QDeclarativeOrganizerCollection(this);
- declCollection->setCollection(*collections.value(collIterator.key()));
+ declCollection->setCollection(*it.value());
d->m_collections.append(declCollection);
}
}
- QHashIterator<QString, QDeclarativeOrganizerCollection*> declCollIterator(declCollections);
- while (declCollIterator.hasNext()) {
- declCollIterator.next();
- if (!collections.contains(declCollIterator.key())) {
+ for (auto it = declCollections.cbegin(), end = declCollections.cend(); it != end; ++it) {
+ if (!collections.contains(it.key())) {
// collection deleted on the backend side, delete from declarative collection list
- QDeclarativeOrganizerCollection* toBeDeletedColl = declCollections.value(declCollIterator.key());
+ QDeclarativeOrganizerCollection* toBeDeletedColl = it.value();
d->m_collections.removeOne(toBeDeletedColl);
toBeDeletedColl->deleteLater();
}