diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-09-10 14:15:17 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2022-09-14 20:05:49 +0200 |
commit | 366a6379fb80e8c223ae57b2fd791ffdfeacdbf3 (patch) | |
tree | 379c1b6a8ef4e942de9d99f231fe96e09dcf5eae /src/plugins/geoservices/esri/geocodereply_esri.cpp | |
parent | 517e4f284e1808ecddc998d73b4b554880733381 (diff) | |
download | qtlocation-366a6379fb80e8c223ae57b2fd791ffdfeacdbf3.tar.gz |
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 <ivan.solovev@qt.io>
Diffstat (limited to 'src/plugins/geoservices/esri/geocodereply_esri.cpp')
-rw-r--r-- | src/plugins/geoservices/esri/geocodereply_esri.cpp | 19 |
1 files changed, 5 insertions, 14 deletions
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<QGeoLocation> 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<QGeoLocation> locations; - locations.append(location); - - setLocations(locations); + setLocations({parseAddress(object)}); setFinished(true); } break; |