diff options
Diffstat (limited to 'src/location')
5 files changed, 44 insertions, 27 deletions
diff --git a/src/location/declarativemaps/qdeclarativegeomap.cpp b/src/location/declarativemaps/qdeclarativegeomap.cpp index 1da71fb2..c3a87495 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(); + } } } diff --git a/src/location/declarativemaps/qdeclarativegeomapitembase.cpp b/src/location/declarativemaps/qdeclarativegeomapitembase.cpp index 9a2ae50b..23993faf 100644 --- a/src/location/declarativemaps/qdeclarativegeomapitembase.cpp +++ b/src/location/declarativemaps/qdeclarativegeomapitembase.cpp @@ -126,21 +126,14 @@ void QDeclarativeGeoMapItemBase::setMap(QDeclarativeGeoMap *quickMap, QGeoMap *m return; if (quickMap && quickMap_) return; // don't allow association to more than one map - if (quickMap_) - quickMap_->disconnect(this); - if (map_) - map_->disconnect(this); quickMap_ = quickMap; map_ = map; if (map_ && quickMap_) { - connect(map_, SIGNAL(cameraDataChanged(QGeoCameraData)), - this, SLOT(baseCameraDataChanged(QGeoCameraData))); - connect(map_, SIGNAL(visibleAreaChanged()), - this, SLOT(visibleAreaChanged())); - connect(quickMap, SIGNAL(heightChanged()), this, SLOT(polishAndUpdate())); - connect(quickMap, SIGNAL(widthChanged()), this, SLOT(polishAndUpdate())); + // For performance reasons we're not connecting map_'s and quickMap_'s signals to this. + // Rather, the handling of cameraDataChanged, visibleAreaChanged, heightChanged and widthChanged is done explicitly in QDeclarativeGeoMap by directly calling methods on the items. + // See QTBUG-76950 lastSize_ = QSizeF(quickMap_->width(), quickMap_->height()); lastCameraData_ = map_->cameraData(); } diff --git a/src/location/declarativemaps/qdeclarativegeomapparameter.cpp b/src/location/declarativemaps/qdeclarativegeomapparameter.cpp index 2408e1c7..77a78aee 100644 --- a/src/location/declarativemaps/qdeclarativegeomapparameter.cpp +++ b/src/location/declarativemaps/qdeclarativegeomapparameter.cpp @@ -68,7 +68,7 @@ Q_SIGNALS: \since QtLocation 5.9 \deprecated - Use \l DynamicParameter instead. + This type is deprecated and has been remamed into \l DynamicParameter. */ /*! @@ -78,9 +78,11 @@ Q_SIGNALS: \ingroup qml-QtLocation5-maps \since Qt Location 5.11 - \brief The DynamicParameter type represents a parameter for a Map element. - This type provides a mean to specify plugin-dependent optional parameters - for a map. + \brief The DynamicParameter (previously \l MapParameter ) type represents a parameter for a Map element, + or other elements used in a Map (such as map items, etc.). + This type provides a mean to specify plugin-dependent optional dynamic parameters that allow a plugin to + extend the runtime API of the module. + DynamicParameters by default contain only the \l type property, and are highly plugin-dependent. @@ -89,8 +91,8 @@ Q_SIGNALS: What properties have to be put inside a particular DynamicParameter type for a particular plugin can be found in the documentation of the plugin. - Note that DynamicParameters are \b optional. - By not specifying any of them, the Map will have the default behavior. + \note DynamicParameters are \b optional. + By not specifying any of them, the Map, or other container elements, will have the default behavior. */ /*! diff --git a/src/location/declarativemaps/qquickgeomapgesturearea.cpp b/src/location/declarativemaps/qquickgeomapgesturearea.cpp index a33db67a..a9406ff4 100644 --- a/src/location/declarativemaps/qquickgeomapgesturearea.cpp +++ b/src/location/declarativemaps/qquickgeomapgesturearea.cpp @@ -401,7 +401,7 @@ QT_BEGIN_NAMESPACE starts from the point where the mouse or touch was released, while still in motion. - The corresponding handler is \c onFlichStarted. + The corresponding handler is \c onFlickStarted. */ /*! diff --git a/src/location/labs/qdeclarativenavigator.cpp b/src/location/labs/qdeclarativenavigator.cpp index b266779c..a4caca85 100644 --- a/src/location/labs/qdeclarativenavigator.cpp +++ b/src/location/labs/qdeclarativenavigator.cpp @@ -590,6 +590,7 @@ QDeclarativeNavigationBasicDirections::QDeclarativeNavigationBasicDirections(QDe \qmlproperty Route Qt.labs.location::Navigator::directions.currentRoute \qmlproperty RouteLeg Qt.labs.location::Navigator::directions.currentRouteLeg \qmlproperty int Qt.labs.location::Navigator::directions.currentSegment + \qmlproperty model Qt.labs.location::Navigator::directions.alternativeRoutes These read-only properties are part of the \e directions property group. This property group holds the navigation progress information that can be @@ -628,6 +629,8 @@ QDeclarativeNavigationBasicDirections::QDeclarativeNavigationBasicDirections(QDe holds the same route as \c currentRoute. \li The \c currentSegment property holds the index of the current RouteSegment in the \c currentRoute. + \li The \c alternativeRoutes property holds the list of alternative routes provided by + the engine. If no alternative routes are present, the model will be empty. \endlist \sa directions.waypointReached(), directions.destinationReached(), Route, RouteLeg, RouteSegment, Waypoint |