From 366a6379fb80e8c223ae57b2fd791ffdfeacdbf3 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Sat, 10 Sep 2022 14:15:17 +0200 Subject: Refactor: for loops Replace indexed for loops with ranged for, replace int with qsizetype otherwise as appropriate. Apply const and line breaks in surrounding code. Pick-to: 6.2 Change-Id: I1c2ee372545b8ab2cbb84c4b4b97ae52dedff1d0 Reviewed-by: Ivan Solovev --- src/plugins/geoservices/esri/geocodereply_esri.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'src/plugins/geoservices/esri/geocodereply_esri.cpp') diff --git a/src/plugins/geoservices/esri/geocodereply_esri.cpp b/src/plugins/geoservices/esri/geocodereply_esri.cpp index 1ef3c9d6..cc2ea378 100644 --- a/src/plugins/geoservices/esri/geocodereply_esri.cpp +++ b/src/plugins/geoservices/esri/geocodereply_esri.cpp @@ -95,18 +95,14 @@ void GeoCodeReplyEsri::networkReplyFinished() switch (operationType()) { case Geocode: { - QJsonArray candidates = object.value(QStringLiteral("candidates")).toArray(); + const QJsonArray candidates = object.value(QStringLiteral("candidates")).toArray(); QList locations; - for (int i = 0; i < candidates.count(); i++) { - if (!candidates.at(i).isObject()) + for (const auto candidate : candidates) { + if (!candidate.isObject()) continue; - - QJsonObject candidate = candidates.at(i).toObject(); - - QGeoLocation location = parseCandidate(candidate); - locations.append(location); + locations.append(parseCandidate(candidate.toObject())); } setLocations(locations); @@ -116,12 +112,7 @@ void GeoCodeReplyEsri::networkReplyFinished() case ReverseGeocode: { - QGeoLocation location = parseAddress(object); - - QList locations; - locations.append(location); - - setLocations(locations); + setLocations({parseAddress(object)}); setFinished(true); } break; -- cgit v1.2.1