diff options
author | Thiago Marcos P. Santos <tmpsantos@gmail.com> | 2017-03-06 11:59:55 -0800 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2017-03-06 21:01:08 +0000 |
commit | 7a6c1a93a0c1f7305f861b2f717bf71f2c7eaae7 (patch) | |
tree | 0e47e7f133dec02564941bb36459bd3b739af5b8 /src/location/declarativemaps/qdeclarativegeomap.cpp | |
parent | c580d99097763d915a8fc1479060e3f6b0a00147 (diff) | |
download | qtlocation-7a6c1a93a0c1f7305f861b2f717bf71f2c7eaae7.tar.gz |
Add mapReady to notify when the map is ready
This adds a mean to notify when the Map becomes truly ready.
This property should always be used in place of listening on the
Component completed() signal.
Change-Id: I98db7a4fd1fea6e54f6e6eca7ac50f26f90276f5
Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
Diffstat (limited to 'src/location/declarativemaps/qdeclarativegeomap.cpp')
-rw-r--r-- | src/location/declarativemaps/qdeclarativegeomap.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/location/declarativemaps/qdeclarativegeomap.cpp b/src/location/declarativemaps/qdeclarativegeomap.cpp index 604b0c46..8ab29c1a 100644 --- a/src/location/declarativemaps/qdeclarativegeomap.cpp +++ b/src/location/declarativemaps/qdeclarativegeomap.cpp @@ -159,12 +159,6 @@ QT_BEGIN_NAMESPACE application should open the link in a browser or display its contents to the user. */ -/*! - \qmlsignal QtLocation::Map::initialized() - - This signal is emitted when the initialization of the map is complete. -*/ - QDeclarativeGeoMap::QDeclarativeGeoMap(QQuickItem *parent) : QQuickItem(parent), m_plugin(0), @@ -424,7 +418,7 @@ void QDeclarativeGeoMap::initialize() if (fovHasChanged) emit fieldOfViewChanged(m_cameraData.fieldOfView()); - emit initialized(); + emit mapReadyChanged(true); } /*! @@ -1330,6 +1324,21 @@ QColor QDeclarativeGeoMap::color() const return m_color; } +/*! + \qmlproperty color QtLocation::Map::mapReady + + This property holds whether the map has been successfully initialized and is ready to be used. + Some methods, such as \l fromCoordinate and \l toCoordinate, will not work before the map is ready. + Due to the architecture of the \l Map, it's advised to use the signal emitted for this property + in place of \l Component.onCompleted, to make sure that everything behaves as expected. + + \since 5.9 +*/ +bool QDeclarativeGeoMap::mapReady() const +{ + return m_initialized; +} + // TODO: offer the possibility to specify the margins. void QDeclarativeGeoMap::fitViewportToGeoShape() { |