From da870b829cc860ca394af836733dbcc002016061 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Sun, 24 Jul 2022 12:39:01 +0200 Subject: Replace foreach with ranged for and set QT_NO_FOREACH Make containers const where they obviously should be, iterate over references where it's clearly possible. Cherry-pick of 2c8c5dca44aba5612cc67b04dd3c7e5fc4919b19. Change-Id: Ie55a58873b48bbb60ac49790db612f85777e6ceb Reviewed-by: Volker Hilsheimer --- src/plugins/geoservices/osm/qplacemanagerengineosm.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/plugins/geoservices/osm/qplacemanagerengineosm.cpp') diff --git a/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp b/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp index c0d467f4..8c29652c 100644 --- a/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp +++ b/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp @@ -158,7 +158,7 @@ QPlaceSearchReply *QPlaceManagerEngineOsm::search(const QPlaceSearchRequest &req if (!request.searchTerm().isEmpty()) queryParts.append(request.searchTerm()); - foreach (const QPlaceCategory &category, request.categories()) { + for (const QPlaceCategory &category : request.categories()) { QString id = category.categoryId(); int index = id.indexOf(QLatin1Char('=')); if (index != -1) @@ -239,7 +239,7 @@ QPlaceCategory QPlaceManagerEngineOsm::category(const QString &categoryId) const QList QPlaceManagerEngineOsm::childCategories(const QString &parentId) const { QList categories; - foreach (const QString &id, m_subcategories.value(parentId)) + for (const QString &id : m_subcategories.value(parentId)) categories.append(m_categories.value(id)); return categories; } @@ -315,14 +315,14 @@ void QPlaceManagerEngineOsm::categoryReplyFinished() m_categoryLocales.clear(); } - foreach (QPlaceCategoriesReplyOsm *reply, m_pendingCategoriesReply) + for (QPlaceCategoriesReplyOsm *reply : m_pendingCategoriesReply) reply->emitFinished(); m_pendingCategoriesReply.clear(); } void QPlaceManagerEngineOsm::categoryReplyError() { - foreach (QPlaceCategoriesReplyOsm *reply, m_pendingCategoriesReply) + for (QPlaceCategoriesReplyOsm *reply : m_pendingCategoriesReply) reply->setError(QPlaceReply::CommunicationError, tr("Network request error")); } -- cgit v1.2.1