summaryrefslogtreecommitdiff
path: root/src/location/declarativeplaces/qdeclarativesearchresultmodel.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2019-07-10 15:45:10 +0200
committerMarc Mutz <marc.mutz@kdab.com>2019-08-03 21:05:14 +0300
commit44757c534b950e2fca2d56d0ab4228b4123cf080 (patch)
tree6d51e0f3e9877e177a528fb06ae5e755a1d61f4c /src/location/declarativeplaces/qdeclarativesearchresultmodel.cpp
parent266e6a3269ab16846de3d6cbce39aa226d45934c (diff)
downloadqtlocation-44757c534b950e2fca2d56d0ab4228b4123cf080.tar.gz
Eradicate Java-style iterators and mark the module free of them
... and of QLinkedList Java-style iterators are going to be deprecated, or at the very least banned from use in Qt code. Ditto QLinkedList. Unfortunately, the module contains more than 120 uses of Q_FOREACH, even though, according to my sources, its use was banned in Qt implementation from the get-go. So QT_NO_FOREACH is currently not an option. Change-Id: I0f05e9c78dda259b0eac1bcdfc7dddfcddc4b908 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/location/declarativeplaces/qdeclarativesearchresultmodel.cpp')
-rw-r--r--src/location/declarativeplaces/qdeclarativesearchresultmodel.cpp11
1 files changed, 3 insertions, 8 deletions
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)