summaryrefslogtreecommitdiffstats
path: root/src/plugins/geoservices/nokia/qgeocodejsonparser.cpp
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2022-06-10 20:38:50 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2022-06-16 16:08:59 +0200
commita0ed5f9f9c8acf1b4b631b69774ac67ac37739bc (patch)
tree83afaa8ebeb5abd6571b2842f7a68399e652b508 /src/plugins/geoservices/nokia/qgeocodejsonparser.cpp
parent5164413d711409c64f153a2049d587580b15fe5e (diff)
Silence build warnings, fix build errors
Replace various deprecated APIs with their supported Qt 6 versions. Most notably, replace QScopedPointer with std::unique_ptr, as the code frequently use deprecated QScopedPointer::swap. Change-Id: If9cb0be89423fd310073709eb390401d74240153 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/plugins/geoservices/nokia/qgeocodejsonparser.cpp')
-rw-r--r--src/plugins/geoservices/nokia/qgeocodejsonparser.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/plugins/geoservices/nokia/qgeocodejsonparser.cpp b/src/plugins/geoservices/nokia/qgeocodejsonparser.cpp
index e0ebf923..cc8725c4 100644
--- a/src/plugins/geoservices/nokia/qgeocodejsonparser.cpp
+++ b/src/plugins/geoservices/nokia/qgeocodejsonparser.cpp
@@ -274,8 +274,8 @@ bool checkDocument(const QJsonDocument &doc, QString *errorString)
return false;
}
- QJsonArray view = rit.value().toArray();
- for (const QJsonValue &viewElement : view) {
+ const QJsonArray view = rit.value().toArray();
+ for (const QJsonValueConstRef viewElement : view) {
if (!viewElement.isObject()) {
*errorString = QLatin1String("Expected View array element to be object");
return false;
@@ -291,8 +291,8 @@ bool checkDocument(const QJsonDocument &doc, QString *errorString)
return false;
}
- QJsonArray result = voit.value().toArray();
- for (const QJsonValue &resultElement : result) {
+ const QJsonArray result = voit.value().toArray();
+ for (const QJsonValueConstRef resultElement : result) {
if (!resultElement.isObject()) {
*errorString = QLatin1String("Expected Result array element to be object");
return false;
@@ -342,8 +342,8 @@ bool parseLocation(const QJsonObject &obj, const QGeoShape &bounds, QGeoLocation
if (!label.isEmpty()) {
address.setText(label);
}
- QJsonArray additionalData = addr.value("AdditionalData").toArray();
- for (const QJsonValue &adv : additionalData) {
+ const QJsonArray additionalData = addr.value("AdditionalData").toArray();
+ for (const QJsonValueConstRef adv : additionalData) {
if (adv.isObject()) {
const QJsonObject &ado(adv.toObject());
if (ado.value("key").toString() == QLatin1String("CountryName")) {
@@ -369,9 +369,9 @@ bool parseLocation(const QJsonObject &obj, const QGeoShape &bounds, QGeoLocation
void parseDocument(const QJsonDocument &doc, const QGeoShape &bounds, QList<QGeoLocation> *locs)
{
QJsonArray view = doc.object().value("Response").toObject().value("View").toArray();
- for (const QJsonValue &viewElement : view) {
+ for (const QJsonValueRef viewElement : view) {
QJsonArray result = viewElement.toObject().value("Result").toArray();
- for (const QJsonValue &resultElement : result) {
+ for (const QJsonValueRef resultElement : result) {
QGeoLocation location;
if (parseLocation(resultElement.toObject().value("Location").toObject(), bounds, &location)) {
locs->append(location);