summaryrefslogtreecommitdiff
path: root/src/location/declarativemaps/qdeclarativegeomap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/location/declarativemaps/qdeclarativegeomap.cpp')
-rw-r--r--src/location/declarativemaps/qdeclarativegeomap.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/location/declarativemaps/qdeclarativegeomap.cpp b/src/location/declarativemaps/qdeclarativegeomap.cpp
index 6a2d82e8..167f1d5f 100644
--- a/src/location/declarativemaps/qdeclarativegeomap.cpp
+++ b/src/location/declarativemaps/qdeclarativegeomap.cpp
@@ -2058,20 +2058,24 @@ void QDeclarativeGeoMap::clearMapItems()
return;
int removed = 0;
- for (auto i : qAsConst(m_mapItemGroups)) {
+ for (int i = 0; i < m_mapItemGroups.count(); ++i) {
+ auto item = m_mapItemGroups.at(i);
// Processing only top-level groups (!views)
- QDeclarativeGeoMapItemView *view = qobject_cast<QDeclarativeGeoMapItemView *>(i);
- if (view)
+ if (qobject_cast<QDeclarativeGeoMapItemView *>(item))
continue;
- if (i->parentItem() != this)
+
+ if (item->parentItem() != this)
continue;
- removed += removeMapItemGroup_real(i);
+ if (removeMapItemGroup_real(item)) {
+ removed++;
+ --i;
+ }
}
- for (auto i : qAsConst(m_mapItems))
- removed += removeMapItem_real(i);
+ while (!m_mapItems.isEmpty())
+ removed += removeMapItem_real(m_mapItems.first());
if (removed)
emit mapItemsChanged();