summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-12-05 23:24:41 +0100
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2022-12-07 00:55:06 +0100
commit075b7a868f5334028d06c7fb5b5aa09b64365358 (patch)
treefab0c3152c28614848d35f423c2cfbd0f6db1ac0
parent1e30c174402b35d51e5962678e75595ad8f716dc (diff)
downloadqtlocation-075b7a868f5334028d06c7fb5b5aa09b64365358.tar.gz
Mark the module as free of qAsConst()
Change-Id: Ie67ec9b4f1f808b3b70ca7beb98f90c9cd1f2a9f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r--.cmake.conf2
-rw-r--r--src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp8
-rw-r--r--src/location/declarativeplaces/qdeclarativeplace.cpp4
-rw-r--r--src/location/declarativeplaces/qdeclarativesupportedcategoriesmodel.cpp2
-rw-r--r--src/location/maps/qgeocameratiles.cpp8
-rw-r--r--src/location/maps/qgeoprojection.cpp4
-rw-r--r--src/location/maps/qgeorouteparserosrmv5.cpp2
-rw-r--r--src/location/quickmapitems/qdeclarativegeomap.cpp12
-rw-r--r--src/location/quickmapitems/qdeclarativegeomapitembase_p.h2
-rw-r--r--src/plugins/geoservices/esri/placemanagerengine_esri.cpp2
-rw-r--r--src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp2
-rw-r--r--src/plugins/geoservices/mapbox/qplacemanagerenginemapbox.cpp2
-rw-r--r--src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp4
-rw-r--r--src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp2
-rw-r--r--src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp2
-rw-r--r--tests/auto/geotestplugin/qplacemanagerengine_test.h2
-rw-r--r--tests/auto/nokia_services/places_semiauto/tst_places.cpp2
17 files changed, 32 insertions, 30 deletions
diff --git a/.cmake.conf b/.cmake.conf
index 05b80d3a..4fd8de4c 100644
--- a/.cmake.conf
+++ b/.cmake.conf
@@ -1,4 +1,6 @@
set(QT_REPO_MODULE_VERSION "6.5.0")
set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1")
+
+list(APPEND QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_AS_CONST=1")
# Use cpp-based syncqt
set(QT_USE_SYNCQT_CPP TRUE)
diff --git a/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp b/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp
index cc2ec2bb..8b30a9e2 100644
--- a/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp
+++ b/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp
@@ -122,7 +122,7 @@ void QDeclarativeGeoServiceProvider::setName(const QString &name)
\internal
*/
bool QDeclarativeGeoServiceProvider::parametersReady() {
- for (const QDeclarativePluginParameter *p: qAsConst(parameters_)) {
+ for (const QDeclarativePluginParameter *p: std::as_const(parameters_)) {
if (!p->isInitialized())
return false;
}
@@ -176,7 +176,7 @@ void QDeclarativeGeoServiceProvider::componentComplete()
{
complete_ = true;
- for (QDeclarativePluginParameter *p: qAsConst(parameters_)) {
+ for (QDeclarativePluginParameter *p: std::as_const(parameters_)) {
if (!p->isInitialized()) {
connect(p, &QDeclarativePluginParameter::initialized,
this, &QDeclarativeGeoServiceProvider::tryAttach);
@@ -195,7 +195,7 @@ void QDeclarativeGeoServiceProvider::componentComplete()
QStringList providers = QGeoServiceProvider::availableServiceProviders();
/* first check any preferred plugins */
- for (const QString &name : qAsConst(prefer_)) {
+ for (const QString &name : std::as_const(prefer_)) {
if (providers.contains(name)) {
// so we don't try it again later
providers.removeAll(name);
@@ -209,7 +209,7 @@ void QDeclarativeGeoServiceProvider::componentComplete()
}
/* then try the rest */
- for (const QString &name : qAsConst(providers)) {
+ for (const QString &name : std::as_const(providers)) {
QGeoServiceProvider sp(name, parameterMap(), experimental_);
if (required_->matches(&sp)) {
setName(name);
diff --git a/src/location/declarativeplaces/qdeclarativeplace.cpp b/src/location/declarativeplaces/qdeclarativeplace.cpp
index dd7ab785..80ed9580 100644
--- a/src/location/declarativeplaces/qdeclarativeplace.cpp
+++ b/src/location/declarativeplaces/qdeclarativeplace.cpp
@@ -371,7 +371,7 @@ QPlace QDeclarativePlace::place() const
// Categories
QList<QPlaceCategory> categories;
- for (QDeclarativeCategory *value : qAsConst(m_categories))
+ for (QDeclarativeCategory *value : std::as_const(m_categories))
categories.append(value->category());
result.setCategories(categories);
@@ -900,7 +900,7 @@ void QDeclarativePlace::category_clear(QQmlListProperty<QDeclarativeCategory> *p
if (object->m_categories.isEmpty())
return;
- for (auto *category : qAsConst(object->m_categories)) {
+ for (auto *category : std::as_const(object->m_categories)) {
if (category->parent() == object)
object->m_categoriesToBeDeleted.append(category);
}
diff --git a/src/location/declarativeplaces/qdeclarativesupportedcategoriesmodel.cpp b/src/location/declarativeplaces/qdeclarativesupportedcategoriesmodel.cpp
index cf7be29b..5c50c65c 100644
--- a/src/location/declarativeplaces/qdeclarativesupportedcategoriesmodel.cpp
+++ b/src/location/declarativeplaces/qdeclarativesupportedcategoriesmodel.cpp
@@ -643,7 +643,7 @@ QStringList QDeclarativeSupportedCategoriesModel::populateCategories(QPlaceManag
auto categories = manager->childCategories(parent.categoryId());
std::sort(categories.begin(), categories.end(), byName);
- for (const auto &category : qAsConst(categories)) {
+ for (const auto &category : std::as_const(categories)) {
auto node = new PlaceCategoryNode;
node->parentId = parent.categoryId();
node->declCategory = QSharedPointer<QDeclarativeCategory>(new QDeclarativeCategory(category, m_plugin ,this));
diff --git a/src/location/maps/qgeocameratiles.cpp b/src/location/maps/qgeocameratiles.cpp
index fc588857..2eab28d3 100644
--- a/src/location/maps/qgeocameratiles.cpp
+++ b/src/location/maps/qgeocameratiles.cpp
@@ -501,14 +501,14 @@ QGeoCameraTilesPrivate::ClippedFootprint QGeoCameraTilesPrivate::clipFootprintTo
if (clipY1)
results = splitPolygonAtAxisValue(results, 1, side).first;
- for (const QDoubleVector3D &p : qAsConst(results)) {
+ for (const QDoubleVector3D &p : std::as_const(results)) {
if ((p.x() < 0.0) || (qFuzzyIsNull(p.x())))
clipX0 = true;
if ((p.x() > side) || (qFuzzyCompare(side, p.x())))
clipX1 = true;
}
- for (const QDoubleVector3D &v : qAsConst(results)) {
+ for (const QDoubleVector3D &v : std::as_const(results)) {
minX = qMin(v.x(), minX);
maxX = qMax(v.x(), maxX);
}
@@ -538,7 +538,7 @@ QGeoCameraTilesPrivate::ClippedFootprint QGeoCameraTilesPrivate::clipFootprintTo
QPair<PolygonVector, PolygonVector> pair = splitPolygonAtAxisValue(results, 0, 0.0);
if (pair.first.isEmpty()) {
// if we touched the line but didn't cross it...
- for (const auto &v : qAsConst(pair.second)) {
+ for (const auto &v : std::as_const(pair.second)) {
if (qFuzzyIsNull(v.x()))
pair.first.append(v);
}
@@ -574,7 +574,7 @@ QGeoCameraTilesPrivate::ClippedFootprint QGeoCameraTilesPrivate::clipFootprintTo
QPair<PolygonVector, PolygonVector> pair = splitPolygonAtAxisValue(results, 0, side);
if (pair.second.isEmpty()) {
// if we touched the line but didn't cross it...
- for (const auto &v : qAsConst(pair.first)) {
+ for (const auto &v : std::as_const(pair.first)) {
if (qFuzzyCompare(side, v.x()))
pair.second.append(v);
}
diff --git a/src/location/maps/qgeoprojection.cpp b/src/location/maps/qgeoprojection.cpp
index d39c36d6..b23d15a0 100644
--- a/src/location/maps/qgeoprojection.cpp
+++ b/src/location/maps/qgeoprojection.cpp
@@ -834,12 +834,12 @@ void QGeoProjectionWebMercator::updateVisibleRegion()
// Compute m_visibleRegionExpanded as a clipped expanded version of m_visibleRegion
QDoubleVector2D centroid;
- for (const QDoubleVector2D &v: qAsConst(m_visibleRegion))
+ for (const QDoubleVector2D &v: std::as_const(m_visibleRegion))
centroid += v;
centroid /= m_visibleRegion.size();
m_visibleRegionExpanded.clear();
- for (const QDoubleVector2D &v: qAsConst(m_visibleRegion)) {
+ for (const QDoubleVector2D &v: std::as_const(m_visibleRegion)) {
const QDoubleVector2D vc = v - centroid;
m_visibleRegionExpanded.push_back(centroid + vc * 1.2); // fixing expansion factor to 1.2
}
diff --git a/src/location/maps/qgeorouteparserosrmv5.cpp b/src/location/maps/qgeorouteparserosrmv5.cpp
index 5d822491..a6585554 100644
--- a/src/location/maps/qgeorouteparserosrmv5.cpp
+++ b/src/location/maps/qgeorouteparserosrmv5.cpp
@@ -980,7 +980,7 @@ QGeoRouteReply::Error QGeoRouteParserOsrmV5Private::parseReply(QList<QGeoRoute>
QGeoRouteSegmentPrivate *segmentPrivate = QGeoRouteSegmentPrivate::get(segment);
segmentPrivate->setLegLastSegment(true);
QList<QGeoCoordinate> path;
- for (const QGeoRouteSegment &s: qAsConst(legSegments))
+ for (const QGeoRouteSegment &s: std::as_const(legSegments))
path.append(s.path());
routeLeg.setLegIndex(legIndex);
routeLeg.setOverallRoute(route); // QGeoRoute::d_ptr is explicitlySharedDataPointer. Modifiers below won't detach it.
diff --git a/src/location/quickmapitems/qdeclarativegeomap.cpp b/src/location/quickmapitems/qdeclarativegeomap.cpp
index c80ee430..6f625801 100644
--- a/src/location/quickmapitems/qdeclarativegeomap.cpp
+++ b/src/location/quickmapitems/qdeclarativegeomap.cpp
@@ -415,7 +415,7 @@ void QDeclarativeGeoMap::populateMap()
for (QQuickItem *ite: quickKids)
kids.insert(ite);
- for (QObject *k : qAsConst(kids)) {
+ for (QObject *k : std::as_const(kids)) {
addMapChild(k);
}
}
@@ -572,7 +572,7 @@ void QDeclarativeGeoMap::mappingManagerInitialized()
// Any map items that were added before the plugin was ready
// need to have setMap called again
- for (const QPointer<QDeclarativeGeoMapItemBase> &item : qAsConst(m_mapItems)) {
+ for (const QPointer<QDeclarativeGeoMapItemBase> &item : std::as_const(m_mapItems)) {
if (item) {
item->setMap(this, m_map);
m_map->addMapItem(item.data()); // m_map filters out what is not supported.
@@ -1376,7 +1376,7 @@ void QDeclarativeGeoMap::setVisibleArea(const QRectF &visibleArea)
const QRectF newVisibleArea = QDeclarativeGeoMap::visibleArea();
if (newVisibleArea != oldVisibleArea) {
// polish map items
- for (const QPointer<QDeclarativeGeoMapItemBase> &i: qAsConst(m_mapItems)) {
+ for (const QPointer<QDeclarativeGeoMapItemBase> &i: std::as_const(m_mapItems)) {
if (i)
i->visibleAreaChanged();
}
@@ -1713,7 +1713,7 @@ void QDeclarativeGeoMap::onCameraDataChanged(const QGeoCameraData &cameraData)
m_cameraData = cameraData;
// polish map items
- for (const QPointer<QDeclarativeGeoMapItemBase> &i: qAsConst(m_mapItems)) {
+ for (const QPointer<QDeclarativeGeoMapItemBase> &i: std::as_const(m_mapItems)) {
if (i)
i->baseCameraDataChanged(m_cameraData); // Consider optimizing this further, removing the contained duplicate if conditions.
}
@@ -1978,7 +1978,7 @@ void QDeclarativeGeoMap::updateItemToWindowTransform()
// the item or one of its ancestors changed), a forced update of the map items using accelerated
// GL implementation has to be performed in order to have them pulling the updated itemToWindowTransform.
if (!m_sgNodeHasChanged && item2WindowOld != item2Window) {
- for (auto i: qAsConst(m_mapItems))
+ for (auto i: std::as_const(m_mapItems))
i->setMaterialDirty();
}
@@ -2082,7 +2082,7 @@ void QDeclarativeGeoMap::geometryChange(const QRectF &newGeometry, const QRectF
m_map->setCameraData(cameraData); // this polishes map items
} else if (oldGeometry.size() != newGeometry.size()) {
// polish map items
- for (const QPointer<QDeclarativeGeoMapItemBase> &i: qAsConst(m_mapItems)) {
+ for (const QPointer<QDeclarativeGeoMapItemBase> &i: std::as_const(m_mapItems)) {
if (i)
i->polishAndUpdate();
}
diff --git a/src/location/quickmapitems/qdeclarativegeomapitembase_p.h b/src/location/quickmapitems/qdeclarativegeomapitembase_p.h
index 315a8c89..be61e0c5 100644
--- a/src/location/quickmapitems/qdeclarativegeomapitembase_p.h
+++ b/src/location/quickmapitems/qdeclarativegeomapitembase_p.h
@@ -123,7 +123,7 @@ public:
const QList<QQuickItem *> quickKids = childItems();
for (const auto &quickKid : quickKids)
kids.append(quickKid);
- for (auto *kid : qAsConst(kids)) {
+ for (auto *kid : std::as_const(kids)) {
if (auto *val = qobject_cast<T*>(kid))
res.push_back(val);
}
diff --git a/src/plugins/geoservices/esri/placemanagerengine_esri.cpp b/src/plugins/geoservices/esri/placemanagerengine_esri.cpp
index f48a9e6d..3c2ae4b2 100644
--- a/src/plugins/geoservices/esri/placemanagerengine_esri.cpp
+++ b/src/plugins/geoservices/esri/placemanagerengine_esri.cpp
@@ -282,7 +282,7 @@ QString PlaceManagerEngineEsri::localizedName(const QJsonObject &jsonObject)
{
const QJsonObject localizedNames = jsonObject.value(kLocalizedNamesKey).toObject();
- for (const QLocale &locale : qAsConst(m_locales)) {
+ for (const QLocale &locale : std::as_const(m_locales)) {
const QString localeStr = locale.name();
if (localizedNames.contains(localeStr))
{
diff --git a/src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp b/src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp
index 7ec90dd8..174840e3 100644
--- a/src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp
+++ b/src/plugins/geoservices/mapbox/qgeotiledmappingmanagerenginemapbox.cpp
@@ -118,7 +118,7 @@ QGeoTiledMappingManagerEngineMapbox::QGeoTiledMappingManagerEngineMapbox(const Q
}
QList<QString> mapIds;
- for (const auto &mapType : qAsConst(mapTypes))
+ for (const auto &mapType : std::as_const(mapTypes))
mapIds.push_back(mapType.name());
setSupportedMapTypes(mapTypes);
diff --git a/src/plugins/geoservices/mapbox/qplacemanagerenginemapbox.cpp b/src/plugins/geoservices/mapbox/qplacemanagerenginemapbox.cpp
index aec7f59e..bef464af 100644
--- a/src/plugins/geoservices/mapbox/qplacemanagerenginemapbox.cpp
+++ b/src/plugins/geoservices/mapbox/qplacemanagerenginemapbox.cpp
@@ -182,7 +182,7 @@ QPlaceReply *QPlaceManagerEngineMapbox::doSearch(const QPlaceSearchRequest &requ
// XXX: Investigate situations where we need to filter by 'country'.
QStringList languageCodes;
- for (const QLocale& locale: qAsConst(m_locales)) {
+ for (const QLocale& locale: std::as_const(m_locales)) {
// Returns the language and country of this locale as a string of the
// form "language_country", where language is a lowercase, two-letter
// ISO 639 language code, and country is an uppercase, two- or
diff --git a/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp b/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp
index 97a4cf39..a1ee42ef 100644
--- a/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp
+++ b/src/plugins/geoservices/mapboxgl/qmapboxglstylechange.cpp
@@ -99,12 +99,12 @@ QMapbox::Feature featureFromMapCircle(QDeclarativeCircleMapItem *mapItem)
QGeoCoordinate leftBound;
QDeclarativeCircleMapItemPrivate::calculatePeripheralPoints(path, mapItem->center(), mapItem->radius(), circleSamples, leftBound);
QList<QDoubleVector2D> pathProjected;
- for (const QGeoCoordinate &c : qAsConst(path))
+ for (const QGeoCoordinate &c : std::as_const(path))
pathProjected << p.geoToMapProjection(c);
if (QDeclarativeCircleMapItemPrivateCPU::crossEarthPole(mapItem->center(), mapItem->radius()))
QDeclarativeCircleMapItemPrivateCPU::preserveCircleGeometry(pathProjected, mapItem->center(), mapItem->radius(), p);
path.clear();
- for (const QDoubleVector2D &c : qAsConst(pathProjected))
+ for (const QDoubleVector2D &c : std::as_const(pathProjected))
path << p.mapProjectionToGeo(c);
diff --git a/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp b/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp
index 9fe0a997..a3eb3f96 100644
--- a/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp
+++ b/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp
@@ -817,7 +817,7 @@ QByteArray QPlaceManagerEngineNokiaV2::createLanguageString() const
if (locales.isEmpty())
locales << QLocale();
- for (const QLocale &loc : qAsConst(locales)) {
+ for (const QLocale &loc : std::as_const(locales)) {
language.append(loc.name().replace(2, 1, QLatin1Char('-')).toLatin1());
language.append(", ");
}
diff --git a/src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp b/src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp
index dd5d7092..54d0255d 100644
--- a/src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp
+++ b/src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp
@@ -233,7 +233,7 @@ QGeoTiledMappingManagerEngineOsm::QGeoTiledMappingManagerEngineOsm(const QVarian
if (parameters.contains(QStringLiteral("osm.mapping.providersrepository.disabled")))
disableRedirection = parameters.value(QStringLiteral("osm.mapping.providersrepository.disabled")).toBool();
- for (QGeoTileProviderOsm * provider: qAsConst(m_providers)) {
+ for (QGeoTileProviderOsm * provider: std::as_const(m_providers)) {
// Providers are parented inside QGeoFileTileCacheOsm, as they are used in its destructor.
if (disableRedirection) {
provider->disableRedirection();
diff --git a/tests/auto/geotestplugin/qplacemanagerengine_test.h b/tests/auto/geotestplugin/qplacemanagerengine_test.h
index d09b3aa6..2c1dc0b6 100644
--- a/tests/auto/geotestplugin/qplacemanagerengine_test.h
+++ b/tests/auto/geotestplugin/qplacemanagerengine_test.h
@@ -500,7 +500,7 @@ public:
} else if (!query.categories().isEmpty()) {
const auto &categoryList = query.categories();
const QSet<QPlaceCategory> categories(categoryList.cbegin(), categoryList.cend());
- for (const QPlace &place : qAsConst(m_places)) {
+ for (const QPlace &place : std::as_const(m_places)) {
const auto &placeCategoryList = place.categories();
const QSet<QPlaceCategory> placeCategories(placeCategoryList.cbegin(), placeCategoryList.cend());
if (!placeCategories.intersects(categories))
diff --git a/tests/auto/nokia_services/places_semiauto/tst_places.cpp b/tests/auto/nokia_services/places_semiauto/tst_places.cpp
index 0cf879bd..6fe46b15 100644
--- a/tests/auto/nokia_services/places_semiauto/tst_places.cpp
+++ b/tests/auto/nokia_services/places_semiauto/tst_places.cpp
@@ -618,7 +618,7 @@ void tst_QPlaceManagerNokia::content()
QVERIFY(results.count() > 0);
- for (const auto &content : qAsConst(results)) {
+ for (const auto &content : std::as_const(results)) {
switch (type) {
case QPlaceContent::ImageType:
QVERIFY(!content.value(QPlaceContent::ImageUrl).value<QUrl>().isEmpty());