diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-05-27 13:39:29 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-05-27 16:05:33 +0200 |
commit | b9a3306bb9dd89155ca33bdb4d42675fc69aa26b (patch) | |
tree | 696bd028ca46680ff3e633b5c18bafd2b9c326dd | |
parent | 971423c512623b84618cfc73b992da1f1dc014f8 (diff) | |
download | qtlocation-b9a3306bb9dd89155ca33bdb4d42675fc69aa26b.tar.gz |
Fix deprecation warnings
Fix warnings:
maps/qgeotilefetcher.cpp:78:36: warning: 'QList<T> QSet<T>::toList() const [with T = QGeoTileSpec]' is deprecated: Use values() instead. [-Wdeprecated-declarations]
declarativeplaces/qdeclarativeplace.cpp:1088:101: warning: 'QVariant qVariantFromValue(const T&) [with T = QDeclarativePlaceAttribute*]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations]
maps/qgeotiledmapscene.cpp:498:62: warning: 'static QSet<T> QSet<T>::fromList(const QList<T>&) [with T = QGeoTileSpec]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
maps/qgeotiledmapscene.cpp:498:89: warning: 'static QSet<T> QSet<T>::fromList(const QList<T>&) [with T = QGeoTileSpec]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
maps/qgeotiledmapscene.cpp:643:61: warning: 'static QSet<T> QSet<T>::fromList(const QList<T>&) [with T = QGeoTileSpec]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
maps/qgeotiledmapscene.cpp:643:94: warning: 'static QSet<T> QSet<T>::fromList(const QList<T>&) [with T = QGeoTileSpec]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
/data1/frkleint/qt-dev/qtbase/include/QtCore/../../src/corelib/tools/qset.h:400:23: warning: 'QSet<T> QList<T>::toSet() const [with T = QGeoTileSpec]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
declarativemaps/qdeclarativegeomap.cpp:453:45: warning: 'QSet<T> QList<T>::toSet() const [with T = QObject*]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
qplacemanagerengine_test.h:477:72: warning: 'QSet<T> QList<T>::toSet() const [with T = QPlaceCategory]' is deprecated: Use QSet<T>(list.begin(), list.end()) instead. [-Wdeprecated-declarations]
../utils/qlocationtestutils.cpp:50:31: warning: 'QString& QString::sprintf(const char*, ...)' is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
Change-Id: Ice04fd0f158ee95a42f53b33dcb7b9204a33c90e
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r-- | src/location/declarativemaps/qdeclarativegeomap.cpp | 2 | ||||
-rw-r--r-- | src/location/declarativeplaces/qdeclarativeplace.cpp | 2 | ||||
-rw-r--r-- | src/location/maps/qgeotiledmapscene.cpp | 8 | ||||
-rw-r--r-- | src/location/maps/qgeotilefetcher.cpp | 5 | ||||
-rw-r--r-- | tests/auto/geotestplugin/qplacemanagerengine_test.h | 9 | ||||
-rw-r--r-- | tests/auto/utils/qlocationtestutils.cpp | 3 |
6 files changed, 19 insertions, 10 deletions
diff --git a/src/location/declarativemaps/qdeclarativegeomap.cpp b/src/location/declarativemaps/qdeclarativegeomap.cpp index 4074bcad..f9bf5805 100644 --- a/src/location/declarativemaps/qdeclarativegeomap.cpp +++ b/src/location/declarativemaps/qdeclarativegeomap.cpp @@ -450,7 +450,7 @@ QQuickGeoMapGestureArea *QDeclarativeGeoMap::gesture() */ void QDeclarativeGeoMap::populateMap() { - QSet<QObject *> kids = children().toSet(); + QSet<QObject *> kids(children().cbegin(), children().cend()); const QList<QQuickItem *> quickKids = childItems(); for (QQuickItem *ite: quickKids) kids.insert(ite); diff --git a/src/location/declarativeplaces/qdeclarativeplace.cpp b/src/location/declarativeplaces/qdeclarativeplace.cpp index 7ab40fea..d10d5942 100644 --- a/src/location/declarativeplaces/qdeclarativeplace.cpp +++ b/src/location/declarativeplaces/qdeclarativeplace.cpp @@ -1085,7 +1085,7 @@ void QDeclarativePlace::pullExtendedAttributes() QStringList attributeTypes = m_src.extendedAttributeTypes(); foreach (const QString &attributeType, attributeTypes) { m_extendedAttributes->insert(attributeType, - qVariantFromValue(new QDeclarativePlaceAttribute(m_src.extendedAttribute(attributeType)))); + QVariant::fromValue(new QDeclarativePlaceAttribute(m_src.extendedAttribute(attributeType)))); } emit extendedAttributesChanged(); diff --git a/src/location/maps/qgeotiledmapscene.cpp b/src/location/maps/qgeotiledmapscene.cpp index a5f94c8d..a8bee156 100644 --- a/src/location/maps/qgeotiledmapscene.cpp +++ b/src/location/maps/qgeotiledmapscene.cpp @@ -495,7 +495,9 @@ void QGeoTiledMapRootNode::updateTiles(QGeoTiledMapTileContainerNode *root, cameraMatrix.lookAt(toVector3D(eye), toVector3D(center), toVector3D(d->m_cameraUp)); root->setMatrix(d->m_projectionMatrix * cameraMatrix); - const QSet<QGeoTileSpec> tilesInSG = QSet<QGeoTileSpec>::fromList(root->tiles.keys()); + QSet<QGeoTileSpec> tilesInSG; + for (auto it = root->tiles.cbegin(), end = root->tiles.cend(); it != end; ++it) + tilesInSG.insert(it.key()); const QSet<QGeoTileSpec> toRemove = tilesInSG - d->m_visibleTiles; const QSet<QGeoTileSpec> toAdd = d->m_visibleTiles - tilesInSG; @@ -640,7 +642,9 @@ QSGNode *QGeoTiledMapScene::updateSceneGraph(QSGNode *oldNode, QQuickWindow *win d->m_updatedTextures.clear(); } - const QSet<QGeoTileSpec> textures = QSet<QGeoTileSpec>::fromList(mapRoot->textures.keys()); + QSet<QGeoTileSpec> textures; + for (auto it = mapRoot->textures.cbegin(), end = mapRoot->textures.cend(); it != end; ++it) + textures.insert(it.key()); const QSet<QGeoTileSpec> toRemove = textures - d->m_visibleTiles; const QSet<QGeoTileSpec> toAdd = d->m_visibleTiles - textures; diff --git a/src/location/maps/qgeotilefetcher.cpp b/src/location/maps/qgeotilefetcher.cpp index b3f7021b..cfca57ac 100644 --- a/src/location/maps/qgeotilefetcher.cpp +++ b/src/location/maps/qgeotilefetcher.cpp @@ -43,6 +43,9 @@ #include "qgeotilespec_p.h" #include "qgeotiledmap_p.h" +#include <algorithm> +#include <iterator> + QT_BEGIN_NAMESPACE QGeoTileFetcher::QGeoTileFetcher(QGeoMappingManagerEngine *parent) @@ -75,7 +78,7 @@ void QGeoTileFetcher::updateTileRequests(const QSet<QGeoTileSpec> &tilesAdded, cancelTileRequests(tilesRemoved); - d->queue_ += tilesAdded.toList(); + std::copy(tilesAdded.cbegin(), tilesAdded.cend(), std::back_inserter(d->queue_)); if (d->enabled_ && initialized() && !d->queue_.isEmpty() && !d->timer_.isActive()) d->timer_.start(0, this); diff --git a/tests/auto/geotestplugin/qplacemanagerengine_test.h b/tests/auto/geotestplugin/qplacemanagerengine_test.h index 7245ccf1..f015afe7 100644 --- a/tests/auto/geotestplugin/qplacemanagerengine_test.h +++ b/tests/auto/geotestplugin/qplacemanagerengine_test.h @@ -474,9 +474,12 @@ public: results.append(r); } } else if (!query.categories().isEmpty()) { - QSet<QPlaceCategory> categories = query.categories().toSet(); - foreach (const QPlace &place, m_places) { - if (place.categories().toSet().intersect(categories).isEmpty()) + const auto &categoryList = query.categories(); + const QSet<QPlaceCategory> categories(categoryList.cbegin(), categoryList.cend()); + for (const QPlace &place : qAsConst(m_places)) { + const auto &placeCategoryList = place.categories(); + const QSet<QPlaceCategory> placeCategories(placeCategoryList.cbegin(), placeCategoryList.cend()); + if (!placeCategories.intersects(categories)) continue; QPlaceResult r; diff --git a/tests/auto/utils/qlocationtestutils.cpp b/tests/auto/utils/qlocationtestutils.cpp index d6e77855..df595daa 100644 --- a/tests/auto/utils/qlocationtestutils.cpp +++ b/tests/auto/utils/qlocationtestutils.cpp @@ -46,8 +46,7 @@ QString QLocationTestUtils::addNmeaChecksumAndBreaks(const QString &sentence) int result = 0; for (int i=1; i<sentence.length()-1; i++) result ^= sentence[i].toLatin1(); - QString sum; - sum.sprintf("%02x", result); + const QString sum = QString::asprintf("%02x", result); return sentence + sum + "\r\n"; } |