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/placesearchreply_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/placesearchreply_esri.cpp')
-rw-r--r-- | src/plugins/geoservices/esri/placesearchreply_esri.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/plugins/geoservices/esri/placesearchreply_esri.cpp b/src/plugins/geoservices/esri/placesearchreply_esri.cpp index 2d26d2ca..1c79a6a1 100644 --- a/src/plugins/geoservices/esri/placesearchreply_esri.cpp +++ b/src/plugins/geoservices/esri/placesearchreply_esri.cpp @@ -119,28 +119,22 @@ void PlaceSearchReplyEsri::replyFinished() return; QJsonDocument document = QJsonDocument::fromJson(reply->readAll()); - if (!document.isObject()) - { + if (!document.isObject()) { setError(ParseError, tr("Response parse error")); return; } QJsonValue suggestions = document.object().value(kCandidatesKey); - if (!suggestions.isArray()) - { + if (!suggestions.isArray()) { setError(ParseError, tr("Response parse error")); return; } - QJsonArray resultsArray = suggestions.toArray(); + const QJsonArray resultsArray = suggestions.toArray(); QList<QPlaceSearchResult> results; - for (int i = 0; i < resultsArray.count(); ++i) - { - QJsonObject item = resultsArray.at(i).toObject(); - QPlaceResult placeResult = parsePlaceResult(item); - results.append(placeResult); - } + for (const auto result : resultsArray) + results.append(parsePlaceResult(result.toObject())); setResults(results); setFinished(true); |