summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf4
-rw-r--r--src/location/declarativeplaces/qdeclarativeplacecontentmodel.cpp25
-rw-r--r--src/location/declarativeplaces/qdeclarativesearchresultmodel.cpp11
-rw-r--r--src/location/doc/snippets/places/requesthandler.h4
-rw-r--r--src/location/places/qplace.cpp5
-rw-r--r--tests/auto/geotestplugin/qplacemanagerengine_test.h18
-rw-r--r--tests/auto/nokia_services/places_semiauto/tst_places.cpp4
-rw-r--r--tests/auto/qgeotiledmap/tst_qgeotiledmap.cpp7
8 files changed, 28 insertions, 50 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 0647feb0..f06fddf5 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -1,6 +1,8 @@
load(qt_build_config)
-
CONFIG += warning_clean
+
+DEFINES += QT_NO_JAVA_STYLE_ITERATORS QT_NO_LINKED_LIST
+
MODULE_VERSION = 5.14.0
# Adds a way to debug location. The define is needed for multiple subprojects as they
diff --git a/src/location/declarativeplaces/qdeclarativeplacecontentmodel.cpp b/src/location/declarativeplaces/qdeclarativeplacecontentmodel.cpp
index 1920583b..3d64d299 100644
--- a/src/location/declarativeplaces/qdeclarativeplacecontentmodel.cpp
+++ b/src/location/declarativeplaces/qdeclarativeplacecontentmodel.cpp
@@ -149,10 +149,7 @@ void QDeclarativePlaceContentModel::initializeCollection(int totalCount, const Q
int initialCount = m_contentCount;
clearData();
- QMapIterator<int, QPlaceContent> i(collection);
- while (i.hasNext()) {
- i.next();
-
+ for (auto i = collection.cbegin(), end = collection.cend(); i != end; ++i) {
const QPlaceContent &content = i.value();
if (content.type() != m_type)
continue;
@@ -317,11 +314,9 @@ void QDeclarativePlaceContentModel::fetchFinished()
QPlaceContent::Collection contents = reply->content();
//find out which indexes are new and which ones have changed.
- QMapIterator<int, QPlaceContent> it(contents);
QList<int> changedIndexes;
QList<int> newIndexes;
- while (it.hasNext()) {
- it.next();
+ for (auto it = contents.cbegin(), end = contents.cend(); it != end; ++it) {
if (!m_content.contains(it.key()))
newIndexes.append(it.key());
else if (it.value() != m_content.value(it.key()))
@@ -330,14 +325,14 @@ void QDeclarativePlaceContentModel::fetchFinished()
//insert new indexes in blocks where within each
//block, the indexes are consecutive.
- QListIterator<int> newIndexesIter(newIndexes);
int startIndex = -1;
- while (newIndexesIter.hasNext()) {
- int currentIndex = newIndexesIter.next();
+ for (auto it = newIndexes.cbegin(), end = newIndexes.cend(); it != end; ++it) {
+ int currentIndex = *it;
if (startIndex == -1)
startIndex = currentIndex;
- if (!newIndexesIter.hasNext() || (newIndexesIter.hasNext() && (newIndexesIter.peekNext() > (currentIndex + 1)))) {
+ auto next = std::next(it);
+ if (next == end || *next > (currentIndex + 1)) {
beginInsertRows(QModelIndex(),startIndex,currentIndex);
for (int i = startIndex; i <= currentIndex; ++i) {
const QPlaceContent &content = contents.value(i);
@@ -360,13 +355,13 @@ void QDeclarativePlaceContentModel::fetchFinished()
//modify changed indexes in blocks where within each
//block, the indexes are consecutive.
startIndex = -1;
- QListIterator<int> changedIndexesIter(changedIndexes);
- while (changedIndexesIter.hasNext()) {
- int currentIndex = changedIndexesIter.next();
+ for (auto it = changedIndexes.cbegin(), end = changedIndexes.cend(); it != end; ++it) {
+ int currentIndex = *it;
if (startIndex == -1)
startIndex = currentIndex;
- if (!changedIndexesIter.hasNext() || (changedIndexesIter.hasNext() && changedIndexesIter.peekNext() > (currentIndex + 1))) {
+ auto next = std::next(it);
+ if (next == end || *next > (currentIndex + 1)) {
for (int i = startIndex; i <= currentIndex; ++i) {
const QPlaceContent &content = contents.value(i);
m_content.insert(i, content);
diff --git a/src/location/declarativeplaces/qdeclarativesearchresultmodel.cpp b/src/location/declarativeplaces/qdeclarativesearchresultmodel.cpp
index c620b9f7..9129731b 100644
--- a/src/location/declarativeplaces/qdeclarativesearchresultmodel.cpp
+++ b/src/location/declarativeplaces/qdeclarativesearchresultmodel.cpp
@@ -963,20 +963,15 @@ void QDeclarativeSearchResultModel::placeRemoved(const QString &placeId)
QList<QPlaceSearchResult> QDeclarativeSearchResultModel::resultsFromPages() const
{
QList<QPlaceSearchResult> res;
- QMapIterator<int, QList<QPlaceSearchResult>> i(m_pages);
- while (i.hasNext()) {
- i.next();
- res.append(i.value());
- }
+ for (const auto &e : m_pages)
+ res.append(e);
return res;
}
void QDeclarativeSearchResultModel::removePageRow(int row)
{
- QMutableMapIterator<int, QList<QPlaceSearchResult>> i(m_pages);
int scanned = 0;
- while (i.hasNext()) {
- i.next();
+ for (auto i = m_pages.begin(), end = m_pages.end(); i != end; ++i) {
QList<QPlaceSearchResult> &page = i.value();
scanned += page.size();
if (row >= scanned)
diff --git a/src/location/doc/snippets/places/requesthandler.h b/src/location/doc/snippets/places/requesthandler.h
index e5ee0d00..9aa5fe76 100644
--- a/src/location/doc/snippets/places/requesthandler.h
+++ b/src/location/doc/snippets/places/requesthandler.h
@@ -358,8 +358,8 @@ public slots:
//! [Image handler]
void handleImagesReply() {
if (contentReply->error() == QPlaceReply::NoError) {
- QMapIterator<int, QPlaceContent> iter(contentReply->content());
- while (iter.hasNext()) {
+ const auto content = contentReply->content();
+ for (auto iter = content.cbegin(), end = content.cend(); iter != end; ++iter) {
qDebug() << "Index: " << iter.key();
QPlaceImage image = iter.value();
qDebug() << image.url();
diff --git a/src/location/places/qplace.cpp b/src/location/places/qplace.cpp
index ab115b5b..4e3e36d3 100644
--- a/src/location/places/qplace.cpp
+++ b/src/location/places/qplace.cpp
@@ -297,11 +297,8 @@ void QPlace::setContent(QPlaceContent::Type type, const QPlaceContent::Collectio
*/
void QPlace::insertContent(QPlaceContent::Type type, const QPlaceContent::Collection &content)
{
- QMapIterator<int, QPlaceContent> iter(content);
- while (iter.hasNext()) {
- iter.next();
+ for (auto iter = content.cbegin(), end = content.cend(); iter != end; ++iter)
d_ptr->m_contentCollections[type].insert(iter.key(), iter.value());
- }
}
/*!
diff --git a/tests/auto/geotestplugin/qplacemanagerengine_test.h b/tests/auto/geotestplugin/qplacemanagerengine_test.h
index f015afe7..0c707b65 100644
--- a/tests/auto/geotestplugin/qplacemanagerengine_test.h
+++ b/tests/auto/geotestplugin/qplacemanagerengine_test.h
@@ -574,11 +574,8 @@ public:
m_categories.insert(category.categoryId(), category);
QStringList children = m_childCategories.value(parentId);
- QMutableHashIterator<QString, QStringList> i(m_childCategories);
- while (i.hasNext()) {
- i.next();
- i.value().removeAll(category.categoryId());
- }
+ for (QStringList &c : m_childCategories)
+ c.removeAll(category.categoryId());
if (!children.contains(category.categoryId())) {
children.append(category.categoryId());
@@ -614,11 +611,8 @@ public:
} else {
m_categories.remove(categoryId);
- QMutableHashIterator<QString, QStringList> i(m_childCategories);
- while (i.hasNext()) {
- i.next();
- i.value().removeAll(categoryId);
- }
+ for (auto &c : m_childCategories)
+ c.removeAll(categoryId);
}
QMetaObject::invokeMethod(reply, "emitFinished", Qt::QueuedConnection);
@@ -637,9 +631,7 @@ public:
QString parentCategoryId(const QString &categoryId) const override
{
- QHashIterator<QString, QStringList> i(m_childCategories);
- while (i.hasNext()) {
- i.next();
+ for (auto i = m_childCategories.cbegin(), end = m_childCategories.cend(); i != end; ++i) {
if (i.value().contains(categoryId))
return i.key();
}
diff --git a/tests/auto/nokia_services/places_semiauto/tst_places.cpp b/tests/auto/nokia_services/places_semiauto/tst_places.cpp
index 2f68ab44..c198c616 100644
--- a/tests/auto/nokia_services/places_semiauto/tst_places.cpp
+++ b/tests/auto/nokia_services/places_semiauto/tst_places.cpp
@@ -610,9 +610,7 @@ void tst_QPlaceManagerNokia::content()
QVERIFY(results.count() > 0);
- QMapIterator<int, QPlaceContent> iter(results);
- while (iter.hasNext()) {
- iter.next();
+ for (auto iter = results.cbegin(), end = results.cend(); iter != end; ++iter) {
switch (type) {
case (QPlaceContent::ImageType): {
QPlaceImage image = iter.value();
diff --git a/tests/auto/qgeotiledmap/tst_qgeotiledmap.cpp b/tests/auto/qgeotiledmap/tst_qgeotiledmap.cpp
index 5da6b4d4..c7189278 100644
--- a/tests/auto/qgeotiledmap/tst_qgeotiledmap.cpp
+++ b/tests/auto/qgeotiledmap/tst_qgeotiledmap.cpp
@@ -145,7 +145,7 @@ void tst_QGeoTiledMap::fetchTiles()
m_tilesCounter->m_tiles.clear();
m_map->setCameraData(camera);
waitForFetch(visibleCount);
- QSet<QGeoTileSpec> visible = m_tilesCounter->m_tiles;
+ const QSet<QGeoTileSpec> visible = m_tilesCounter->m_tiles;
m_map->clearData();
m_tilesCounter->m_tiles.clear();
m_map->prefetchData();
@@ -164,9 +164,8 @@ void tst_QGeoTiledMap::fetchTiles()
QVERIFY2(visibleCount == visible.size(), "visible count incorrect");
QVERIFY2(prefetchCount == prefetched.size(), "prefetch count incorrect");
- QSetIterator<QGeoTileSpec> i(visible);
- while (i.hasNext())
- QVERIFY2(prefetched.contains(i.next()),"visible tile missing from prefetched tiles");
+ for (const QGeoTileSpec &tile : visible)
+ QVERIFY2(prefetched.contains(tile),"visible tile missing from prefetched tiles");
//for zoomLevels wihtout fractions more tiles are fetched for current zoomlevel due to ViewExpansion
if (qCeil(zoomLevel) != zoomLevel && style == QGeoTiledMap::PrefetchNeighbourLayer && nearestNeighbourLayer < zoomLevel)