diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-11-01 12:20:11 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-11-01 12:20:11 +0100 |
commit | d47ce931797cde751a7df9802acc9917e54ff694 (patch) | |
tree | 2ebc7b52b4de95811283edb91831d25df67692a1 /src/location/declarativemaps/qdeclarativegeomap.cpp | |
parent | 3e7b02e1501599fb69a7c79e44bd59365679d0e9 (diff) | |
parent | c1dd5c2979e1558427536fe2435ff3892afe3e6f (diff) | |
download | qtlocation-d47ce931797cde751a7df9802acc9917e54ff694.tar.gz |
Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts:
.qmake.conf
Change-Id: I21ae20734645fc34b302409163f7400015d8302c
Diffstat (limited to 'src/location/declarativemaps/qdeclarativegeomap.cpp')
-rw-r--r-- | src/location/declarativemaps/qdeclarativegeomap.cpp | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/src/location/declarativemaps/qdeclarativegeomap.cpp b/src/location/declarativemaps/qdeclarativegeomap.cpp index 9a46875e..7cc7a0fa 100644 --- a/src/location/declarativemaps/qdeclarativegeomap.cpp +++ b/src/location/declarativemaps/qdeclarativegeomap.cpp @@ -623,6 +623,15 @@ void QDeclarativeGeoMap::mappingManagerInitialized() if (!m_map) return; + // 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)) { + if (item) { + item->setMap(this, m_map); + m_map->addMapItem(item.data()); // m_map filters out what is not supported. + } + } + /* COPY NOTICE SETUP */ m_copyrights = new QDeclarativeGeoMapCopyrightNotice(this); m_copyrights->setCopyrightsZ(m_maxChildZ + 1); @@ -706,15 +715,6 @@ void QDeclarativeGeoMap::mappingManagerInitialized() emit supportedMapTypesChanged(); emit activeMapTypeChanged(); - // 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)) { - if (item) { - item->setMap(this, m_map); - m_map->addMapItem(item.data()); // m_map filters out what is not supported. - } - } - // Any map item groups that were added before the plugin was ready // DO NOT need to have setMap called again on their children map items // because they have been added to m_mapItems, which is processed right above. @@ -1436,6 +1436,14 @@ void QDeclarativeGeoMap::setVisibleArea(const QRectF &visibleArea) if (m_initialized) { m_map->setVisibleArea(visibleArea); + const QRectF newVisibleArea = QDeclarativeGeoMap::visibleArea(); + if (newVisibleArea != oldVisibleArea) { + // polish map items + for (const QPointer<QDeclarativeGeoMapItemBase> &i: qAsConst(m_mapItems)) { + if (i) + i->visibleAreaChanged(); + } + } } else { m_visibleArea = visibleArea; const QRectF newVisibleArea = QDeclarativeGeoMap::visibleArea(); @@ -1757,6 +1765,11 @@ void QDeclarativeGeoMap::onCameraDataChanged(const QGeoCameraData &cameraData) bool zoomHasChanged = cameraData.zoomLevel() != m_cameraData.zoomLevel(); m_cameraData = cameraData; + // polish map items + for (const QPointer<QDeclarativeGeoMapItemBase> &i: qAsConst(m_mapItems)) { + if (i) + i->baseCameraDataChanged(m_cameraData); // Consider optimizing this further, removing the contained duplicate if conditions. + } if (centerHasChanged) emit centerChanged(m_cameraData.center()); @@ -2241,7 +2254,13 @@ void QDeclarativeGeoMap::geometryChanged(const QRectF &newGeometry, const QRectF QGeoCoordinate coord = cameraData.center(); coord.setLatitude(qBound(m_minimumViewportLatitude, coord.latitude(), m_maximumViewportLatitude)); cameraData.setCenter(coord); - m_map->setCameraData(cameraData); + 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)) { + if (i) + i->polishAndUpdate(); + } } } |