summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2019-10-21 10:45:00 +0200
committerpaolo <paolo.angelelli@qt.io>2019-11-04 11:57:34 +0100
commit0771fa5d6476f51c1d2c9874be4958e4b37d10e3 (patch)
tree8a7b17c0ace7299f4649ca2d11ba7578448cf177
parentb9fe898f64c47edd838d2c7d9cd12faba82c086a (diff)
downloadqtlocation-0771fa5d6476f51c1d2c9874be4958e4b37d10e3.tar.gz
Fix visibleRegionChanged signal emissionv5.14.0-beta3
Emit on mapReady changed, and do not emit before then. Change-Id: I1d5c657119cb63989cfa35f58ce57d24833f6438 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--src/location/declarativemaps/qdeclarativegeomap.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/location/declarativemaps/qdeclarativegeomap.cpp b/src/location/declarativemaps/qdeclarativegeomap.cpp
index 7cc7a0fa..7fd5f78a 100644
--- a/src/location/declarativemaps/qdeclarativegeomap.cpp
+++ b/src/location/declarativemaps/qdeclarativegeomap.cpp
@@ -374,7 +374,10 @@ void QDeclarativeGeoMap::initialize()
connect(m_map.data(), &QGeoMap::cameraDataChanged,
this, &QDeclarativeGeoMap::onCameraDataChanged);
- m_map->setCameraData(cameraData);
+ m_map->setCameraData(cameraData); // This normally triggers property changed signals.
+ // BUT not in this case, since m_cameraData is already == cameraData.
+ // So, emit visibleRegionChanged() separately, as
+ // the effective visible region becomes available only now.
for (auto obj : qAsConst(m_pendingMapObjects))
obj->setMap(m_map);
@@ -386,6 +389,7 @@ void QDeclarativeGeoMap::initialize()
connect(m_map.data(), &QGeoMap::visibleAreaChanged, this, &QDeclarativeGeoMap::visibleAreaChanged);
emit mapReadyChanged(true);
+ emit visibleRegionChanged();
if (m_copyrights) // To not update during initialize()
update();
@@ -894,7 +898,8 @@ void QDeclarativeGeoMap::setZoomLevel(qreal zoomLevel, bool overzoom)
m_cameraData.setZoomLevel(zoomLevel);
if (zlHasChanged) {
emit zoomLevelChanged(zoomLevel);
- emit visibleRegionChanged();
+ // do not emit visibleRegionChanged() here, because, if the map isn't initialized,
+ // the getter won't return anything updated
}
}
}
@@ -980,7 +985,8 @@ void QDeclarativeGeoMap::setBearing(qreal bearing)
m_cameraData.setBearing(bearing);
if (bearingHasChanged) {
emit bearingChanged(bearing);
- emit visibleRegionChanged();
+ // do not emit visibleRegionChanged() here, because, if the map isn't initialized,
+ // the getter won't return anything updated
}
}
}
@@ -1047,7 +1053,8 @@ void QDeclarativeGeoMap::setTilt(qreal tilt)
m_cameraData.setTilt(tilt);
if (tiltHasChanged) {
emit tiltChanged(tilt);
- emit visibleRegionChanged();
+ // do not emit visibleRegionChanged() here, because, if the map isn't initialized,
+ // the getter won't return anything updated
}
}
}
@@ -1107,7 +1114,8 @@ void QDeclarativeGeoMap::setFieldOfView(qreal fieldOfView)
m_cameraData.setFieldOfView(fieldOfView);
if (fovChanged) {
emit fieldOfViewChanged(fieldOfView);
- emit visibleRegionChanged();
+ // do not emit visibleRegionChanged() here, because, if the map isn't initialized,
+ // the getter won't return anything updated
}
}
}
@@ -1276,7 +1284,8 @@ void QDeclarativeGeoMap::setCenter(const QGeoCoordinate &center)
m_cameraData.setCenter(center);
if (centerHasChanged) {
emit centerChanged(center);
- emit visibleRegionChanged();
+ // do not emit visibleRegionChanged() here, because, if the map isn't initialized,
+ // the getter won't return anything updated
}
}
}