diff options
-rw-r--r-- | src/location/declarativemaps/qdeclarativegeomap.cpp | 4 | ||||
-rw-r--r-- | src/location/labs/qgeojson.cpp | 6 | ||||
-rw-r--r-- | src/location/maps/qgeofiletilecache.cpp | 4 | ||||
-rw-r--r-- | src/location/maps/qgeorouteparserosrmv5.cpp | 2 | ||||
-rw-r--r-- | src/location/places/qplaceicon.cpp | 4 | ||||
-rw-r--r-- | src/plugins/geoservices/esri/georoutejsonparser_esri.cpp | 6 | ||||
-rw-r--r-- | src/plugins/geoservices/esri/placemanagerengine_esri.cpp | 6 | ||||
-rw-r--r-- | src/plugins/geoservices/mapbox/qmapboxcommon.cpp | 4 | ||||
-rw-r--r-- | src/plugins/geoservices/nokia/qgeocodejsonparser.cpp | 10 |
9 files changed, 23 insertions, 23 deletions
diff --git a/src/location/declarativemaps/qdeclarativegeomap.cpp b/src/location/declarativemaps/qdeclarativegeomap.cpp index e297c2b1..f5bb156c 100644 --- a/src/location/declarativemaps/qdeclarativegeomap.cpp +++ b/src/location/declarativemaps/qdeclarativegeomap.cpp @@ -182,7 +182,7 @@ QDeclarativeGeoMap::QDeclarativeGeoMap(QQuickItem *parent) m_gestureArea(new QQuickGeoMapGestureArea(this)), m_map(0), m_error(QGeoServiceProvider::NoError), - m_color(QColor::fromRgbF(0.9, 0.9, 0.9)), + m_color(QColor::fromRgbF(0.9f, 0.9f, 0.9f)), m_componentCompleted(false), m_pendingFitViewport(false), m_copyrightsVisible(true), @@ -1628,7 +1628,7 @@ void QDeclarativeGeoMap::clearData() void QDeclarativeGeoMap::fitViewportToGeoShape(const QGeoShape &shape, QVariant margins) { QMargins m(10, 10, 10, 10); // lets defaults to 10 if margins is invalid - switch (static_cast<QMetaType::Type>(margins.type())) { + switch (margins.typeId()) { case QMetaType::Int: case QMetaType::Double: { const int value = int(margins.toDouble()); diff --git a/src/location/labs/qgeojson.cpp b/src/location/labs/qgeojson.cpp index bdd4eacb..7d609a75 100644 --- a/src/location/labs/qgeojson.cpp +++ b/src/location/labs/qgeojson.cpp @@ -988,7 +988,7 @@ QVariantList QGeoJson::importGeoJson(const QJsonDocument &geoJson) // Checking whether the JSON object has a "type" member const QVariant keyVariant = rootGeoJsonObject.value(QStringLiteral("type")); - if (keyVariant == QVariant::Invalid) { + if (!keyVariant.isValid()) { // Type check failed } QString valueType = keyVariant.value<QString>(); @@ -1178,13 +1178,13 @@ QString printQvariant(const QVariant v, int tabs = 0) { for (int i = 0; i< tabs; i++) { sTabs += sTab; } - if (v.type() == QVariant::List) { + if (v.typeId() == QMetaType::QVariantList) { stream << sTabs << "[\n"; const QVariantList &l = v.toList(); for (int i = 0; i < l.size(); ++i) stream << printQvariant(l.at(i), tabs + 1); stream << sTabs << "]\n"; - } else if (v.type() == QVariant::Map) { + } else if (v.typeId() == QMetaType::QVariantMap) { stream << sTabs << "{\n"; const QVariantList &l = v.toList(); const QVariantMap &map = v.toMap(); diff --git a/src/location/maps/qgeofiletilecache.cpp b/src/location/maps/qgeofiletilecache.cpp index 559fc013..8c1b19ee 100644 --- a/src/location/maps/qgeofiletilecache.cpp +++ b/src/location/maps/qgeofiletilecache.cpp @@ -432,13 +432,13 @@ QGeoTileSpec QGeoFileTileCache::filenameToTileSpecDefault(const QString &filenam { QGeoTileSpec emptySpec; - QStringList parts = filename.split('.'); + QStringList parts = filename.split(QLatin1Char('.')); if (parts.length() != 2) return emptySpec; QString name = parts.at(0); - QStringList fields = name.split('-'); + QStringList fields = name.split(QLatin1Char('-')); int length = fields.length(); if (length != 5 && length != 6) diff --git a/src/location/maps/qgeorouteparserosrmv5.cpp b/src/location/maps/qgeorouteparserosrmv5.cpp index cc39158f..d0f3d716 100644 --- a/src/location/maps/qgeorouteparserosrmv5.cpp +++ b/src/location/maps/qgeorouteparserosrmv5.cpp @@ -919,7 +919,7 @@ QGeoRouteReply::Error QGeoRouteParserOsrmV5Private::parseReply(QList<QGeoRoute> } QJsonArray osrmRoutes = object.value(QLatin1String("routes")).toArray(); - foreach (const QJsonValue &r, osrmRoutes) { + for (const QJsonValue &r : osrmRoutes) { if (!r.isObject()) continue; QJsonObject routeObject = r.toObject(); diff --git a/src/location/places/qplaceicon.cpp b/src/location/places/qplaceicon.cpp index c3a2b851..b491bf7d 100644 --- a/src/location/places/qplaceicon.cpp +++ b/src/location/places/qplaceicon.cpp @@ -170,9 +170,9 @@ QUrl QPlaceIcon::url(const QSize &size) const { if (d->parameters.contains(QPlaceIcon::SingleUrl)) { QVariant value = d->parameters.value(QPlaceIcon::SingleUrl); - if (value.type() == QVariant::Url) + if (value.typeId() == QMetaType::QUrl) return value.toUrl(); - else if (value.type() == QVariant::String) + else if (value.typeId() == QMetaType::QString) return QUrl::fromUserInput(value.toString()); return QUrl(); diff --git a/src/plugins/geoservices/esri/georoutejsonparser_esri.cpp b/src/plugins/geoservices/esri/georoutejsonparser_esri.cpp index 17492d94..3f6e3114 100644 --- a/src/plugins/geoservices/esri/georoutejsonparser_esri.cpp +++ b/src/plugins/geoservices/esri/georoutejsonparser_esri.cpp @@ -125,7 +125,7 @@ QString GeoRouteJsonParserEsri::errorString() const void GeoRouteJsonParserEsri::parseDirections() { QJsonArray directions = m_json.value(kDirectionsKey).toArray(); - foreach (const QJsonValue &direction, directions) + for (const QJsonValue &direction : directions) parseDirection(direction.toObject()); } @@ -215,7 +215,7 @@ void GeoRouteJsonParserEsri::parseRoutes() { QJsonObject routes = m_json.value(kRoutesKey).toObject(); QJsonArray features = routes.value(kRoutesFeaturesKey).toArray(); - foreach (const QJsonValue &feature, features) + for (const QJsonValue &feature : features) parseRoute(feature.toObject()); } @@ -230,7 +230,7 @@ void GeoRouteJsonParserEsri::parseRoute(const QJsonObject &route) if (!paths.isEmpty()) { QList<QGeoCoordinate> geoCoordinates; - foreach (const QJsonValue &value, paths.first().toArray()) // only first polyline? + for (const QJsonValue &value : paths.first().toArray()) // only first polyline? { QJsonArray geoCoordinate = value.toArray(); if (geoCoordinate.size() == 2) // ignore 3rd coordinate diff --git a/src/plugins/geoservices/esri/placemanagerengine_esri.cpp b/src/plugins/geoservices/esri/placemanagerengine_esri.cpp index 3858ddf5..3a6a267b 100644 --- a/src/plugins/geoservices/esri/placemanagerengine_esri.cpp +++ b/src/plugins/geoservices/esri/placemanagerengine_esri.cpp @@ -188,7 +188,7 @@ QPlaceReply *PlaceManagerEngineEsri::initializeCategories() void PlaceManagerEngineEsri::parseCategories(const QJsonArray &jsonArray, const QString &parentCategoryId) { - foreach (const QJsonValue &jsonValue, jsonArray) + for (const QJsonValue &jsonValue : jsonArray) { if (!jsonValue.isObject()) continue; @@ -288,7 +288,7 @@ QString PlaceManagerEngineEsri::localizedName(const QJsonObject &jsonObject) void PlaceManagerEngineEsri::parseCandidateFields(const QJsonArray &jsonArray) { - foreach (const QJsonValue &jsonValue, jsonArray) + for (const QJsonValue &jsonValue : jsonArray) { if (!jsonValue.isObject()) continue; @@ -304,7 +304,7 @@ void PlaceManagerEngineEsri::parseCandidateFields(const QJsonArray &jsonArray) void PlaceManagerEngineEsri::parseCountries(const QJsonArray &jsonArray) { - foreach (const QJsonValue &jsonValue, jsonArray) + for (const QJsonValue &jsonValue : jsonArray) { if (!jsonValue.isObject()) continue; diff --git a/src/plugins/geoservices/mapbox/qmapboxcommon.cpp b/src/plugins/geoservices/mapbox/qmapboxcommon.cpp index b88e8f5c..ce097ce1 100644 --- a/src/plugins/geoservices/mapbox/qmapboxcommon.cpp +++ b/src/plugins/geoservices/mapbox/qmapboxcommon.cpp @@ -67,7 +67,7 @@ QGeoLocation QMapboxCommon::parseGeoLocation(const QJsonObject &response) // 'address'. The former provides the street name, and the latter provides // the street number in that case. if (response.value(QStringLiteral("place_type")).isArray()) { - foreach (const QJsonValue &value, response.value(QStringLiteral("place_type")).toArray()) { + for (const QJsonValue &value : response.value(QStringLiteral("place_type")).toArray()) { if (!value.isString()) continue; if (value.toString() == QStringLiteral("address")) { @@ -89,7 +89,7 @@ QGeoLocation QMapboxCommon::parseGeoLocation(const QJsonObject &response) address.setStreet(streetAddress); if (response.value(QStringLiteral("context")).isArray()) { - foreach (const QJsonValue &value, response.value(QStringLiteral("context")).toArray()) { + for (const QJsonValue &value : response.value(QStringLiteral("context")).toArray()) { if (!value.isObject()) continue; diff --git a/src/plugins/geoservices/nokia/qgeocodejsonparser.cpp b/src/plugins/geoservices/nokia/qgeocodejsonparser.cpp index 128f7fd2..44488301 100644 --- a/src/plugins/geoservices/nokia/qgeocodejsonparser.cpp +++ b/src/plugins/geoservices/nokia/qgeocodejsonparser.cpp @@ -272,7 +272,7 @@ bool checkDocument(const QJsonDocument &doc, QString *errorString) } QJsonArray view = rit.value().toArray(); - Q_FOREACH (const QJsonValue &viewElement, view) { + for (const QJsonValue &viewElement : view) { if (!viewElement.isObject()) { *errorString = QLatin1String("Expected View array element to be object"); return false; @@ -289,7 +289,7 @@ bool checkDocument(const QJsonDocument &doc, QString *errorString) } QJsonArray result = voit.value().toArray(); - Q_FOREACH (const QJsonValue &resultElement, result) { + for (const QJsonValue &resultElement : result) { if (!resultElement.isObject()) { *errorString = QLatin1String("Expected Result array element to be object"); return false; @@ -340,7 +340,7 @@ bool parseLocation(const QJsonObject &obj, const QGeoShape &bounds, QGeoLocation address.setText(label); } QJsonArray additionalData = addr.value("AdditionalData").toArray(); - Q_FOREACH (const QJsonValue &adv, additionalData) { + for (const QJsonValue &adv : additionalData) { if (adv.isObject()) { const QJsonObject &ado(adv.toObject()); if (ado.value("key").toString() == QLatin1String("CountryName")) { @@ -366,9 +366,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(); - Q_FOREACH (const QJsonValue &viewElement, view) { + for (const QJsonValue &viewElement : view) { QJsonArray result = viewElement.toObject().value("Result").toArray(); - Q_FOREACH (const QJsonValue &resultElement, result) { + for (const QJsonValue &resultElement : result) { QGeoLocation location; if (parseLocation(resultElement.toObject().value("Location").toObject(), bounds, &location)) { locs->append(location); |