diff options
-rw-r--r-- | .qmake.conf | 2 | ||||
-rw-r--r-- | src/imports/location/location.cpp | 3 | ||||
-rw-r--r-- | src/location/declarativemaps/qdeclarativegeomap.cpp | 28 | ||||
-rw-r--r-- | src/location/declarativemaps/qdeclarativegeomap_p.h | 3 | ||||
-rw-r--r-- | src/location/declarativemaps/qdeclarativegeomapitemview.cpp | 1 | ||||
-rw-r--r-- | src/location/declarativemaps/qdeclarativegeomapitemview_p.h | 2 | ||||
-rw-r--r-- | src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp | 41 | ||||
-rw-r--r-- | src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h | 9 | ||||
-rw-r--r-- | src/location/declarativeplaces/qdeclarativeplace.cpp | 2 | ||||
-rw-r--r-- | src/location/labs/qmapobjectview.cpp | 2 | ||||
-rw-r--r-- | src/location/maps/qgeotiledmapscene.cpp | 8 | ||||
-rw-r--r-- | src/location/maps/qgeotilefetcher.cpp | 5 | ||||
-rw-r--r-- | tests/auto/declarative_core/tst_plugin.qml | 2 | ||||
-rw-r--r-- | tests/auto/geotestplugin/geotestplugin.json | 3 | ||||
-rw-r--r-- | tests/auto/geotestplugin/qgeoserviceproviderplugin_test.h | 4 | ||||
-rw-r--r-- | tests/auto/geotestplugin/qplacemanagerengine_test.h | 9 | ||||
-rw-r--r-- | tests/auto/utils/qlocationtestutils.cpp | 3 |
17 files changed, 100 insertions, 27 deletions
diff --git a/.qmake.conf b/.qmake.conf index d4a60528..0647feb0 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,7 +1,7 @@ load(qt_build_config) CONFIG += warning_clean -MODULE_VERSION = 5.13.0 +MODULE_VERSION = 5.14.0 # Adds a way to debug location. The define is needed for multiple subprojects as they # include the essential headers. diff --git a/src/imports/location/location.cpp b/src/imports/location/location.cpp index 45087751..422b4c72 100644 --- a/src/imports/location/location.cpp +++ b/src/imports/location/location.cpp @@ -200,6 +200,9 @@ public: qmlRegisterType<QDeclarativeGeoRoute, 13>(uri, major, minor, "Route"); qmlRegisterType<QDeclarativeGeoRouteQuery, 13>(uri, major, minor, "RouteQuery"); + minor = 14; + qmlRegisterType<QDeclarativeGeoMap, 14>(uri, major, minor, "Map"); + // Register the latest Qt version as QML type version qmlRegisterModule(uri, QT_VERSION_MAJOR, QT_VERSION_MINOR); diff --git a/src/location/declarativemaps/qdeclarativegeomap.cpp b/src/location/declarativemaps/qdeclarativegeomap.cpp index 5997bd3e..4704dc3e 100644 --- a/src/location/declarativemaps/qdeclarativegeomap.cpp +++ b/src/location/declarativemaps/qdeclarativegeomap.cpp @@ -450,7 +450,7 @@ QQuickGeoMapGestureArea *QDeclarativeGeoMap::gesture() */ void QDeclarativeGeoMap::populateMap() { - QSet<QObject *> kids = children().toSet(); + QSet<QObject *> kids(children().cbegin(), children().cend()); const QList<QQuickItem *> quickKids = childItems(); for (QQuickItem *ite: quickKids) kids.insert(ite); @@ -892,8 +892,10 @@ void QDeclarativeGeoMap::setZoomLevel(qreal zoomLevel, bool overzoom) } else { const bool zlHasChanged = zoomLevel != m_cameraData.zoomLevel(); m_cameraData.setZoomLevel(zoomLevel); - if (zlHasChanged) + if (zlHasChanged) { emit zoomLevelChanged(zoomLevel); + emit visibleRegionChanged(); + } } } @@ -976,8 +978,10 @@ void QDeclarativeGeoMap::setBearing(qreal bearing) } else { const bool bearingHasChanged = bearing != m_cameraData.bearing(); m_cameraData.setBearing(bearing); - if (bearingHasChanged) + if (bearingHasChanged) { emit bearingChanged(bearing); + emit visibleRegionChanged(); + } } } @@ -1041,8 +1045,10 @@ void QDeclarativeGeoMap::setTilt(qreal tilt) } else { const bool tiltHasChanged = tilt != m_cameraData.tilt(); m_cameraData.setTilt(tilt); - if (tiltHasChanged) + if (tiltHasChanged) { emit tiltChanged(tilt); + emit visibleRegionChanged(); + } } } @@ -1099,8 +1105,10 @@ void QDeclarativeGeoMap::setFieldOfView(qreal fieldOfView) } else { const bool fovChanged = fieldOfView != m_cameraData.fieldOfView(); m_cameraData.setFieldOfView(fieldOfView); - if (fovChanged) + if (fovChanged) { emit fieldOfViewChanged(fieldOfView); + emit visibleRegionChanged(); + } } } @@ -1266,8 +1274,10 @@ void QDeclarativeGeoMap::setCenter(const QGeoCoordinate ¢er) } else { const bool centerHasChanged = center != m_cameraData.center(); m_cameraData.setCenter(center); - if (centerHasChanged) + if (centerHasChanged) { emit centerChanged(center); + emit visibleRegionChanged(); + } } } @@ -1309,15 +1319,18 @@ void QDeclarativeGeoMap::setVisibleRegion(const QGeoShape &shape) // shape invalidated -> nothing to fit anymore m_visibleRegion = QGeoRectangle(); m_pendingFitViewport = false; + emit visibleRegionChanged(); return; } if (!m_map || !width() || !height()) { m_pendingFitViewport = true; + emit visibleRegionChanged(); return; } fitViewportToGeoShape(m_visibleRegion); + emit visibleRegionChanged(); } QGeoShape QDeclarativeGeoMap::visibleRegion() const @@ -1755,6 +1768,9 @@ void QDeclarativeGeoMap::onCameraDataChanged(const QGeoCameraData &cameraData) emit tiltChanged(m_cameraData.tilt()); if (fovHasChanged) emit fieldOfViewChanged(m_cameraData.fieldOfView()); + if (centerHasChanged || zoomHasChanged || bearingHasChanged + || tiltHasChanged || fovHasChanged) + emit visibleRegionChanged(); } /*! diff --git a/src/location/declarativemaps/qdeclarativegeomap_p.h b/src/location/declarativemaps/qdeclarativegeomap_p.h index 55751365..c97c3622 100644 --- a/src/location/declarativemaps/qdeclarativegeomap_p.h +++ b/src/location/declarativemaps/qdeclarativegeomap_p.h @@ -97,7 +97,7 @@ class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoMap : public QQuickItem Q_PROPERTY(QList<QObject *> mapParameters READ mapParameters) Q_PROPERTY(QGeoServiceProvider::Error error READ error NOTIFY errorChanged) Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged) - Q_PROPERTY(QGeoShape visibleRegion READ visibleRegion WRITE setVisibleRegion) + Q_PROPERTY(QGeoShape visibleRegion READ visibleRegion WRITE setVisibleRegion NOTIFY visibleRegionChanged) Q_PROPERTY(bool copyrightsVisible READ copyrightsVisible WRITE setCopyrightsVisible NOTIFY copyrightsVisibleChanged) Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) Q_PROPERTY(bool mapReady READ mapReady NOTIFY mapReadyChanged) @@ -233,6 +233,7 @@ Q_SIGNALS: void mapReadyChanged(bool ready); Q_REVISION(11) void mapObjectsChanged(); void visibleAreaChanged(); + Q_REVISION(14) void visibleRegionChanged(); protected: void mousePressEvent(QMouseEvent *event) override ; diff --git a/src/location/declarativemaps/qdeclarativegeomapitemview.cpp b/src/location/declarativemaps/qdeclarativegeomapitemview.cpp index f7a251a2..43e24620 100644 --- a/src/location/declarativemaps/qdeclarativegeomapitemview.cpp +++ b/src/location/declarativemaps/qdeclarativegeomapitemview.cpp @@ -42,7 +42,6 @@ #include <QtCore/QAbstractItemModel> #include <QtQml/QQmlContext> -#include <QtQml/private/qqmldelegatemodel_p.h> #include <QtQml/private/qqmlopenmetaobject_p.h> #include <QtQuick/private/qquickanimation_p.h> #include <QtQml/QQmlListProperty> diff --git a/src/location/declarativemaps/qdeclarativegeomapitemview_p.h b/src/location/declarativemaps/qdeclarativegeomapitemview_p.h index abac5bd5..8b2ab034 100644 --- a/src/location/declarativemaps/qdeclarativegeomapitemview_p.h +++ b/src/location/declarativemaps/qdeclarativegeomapitemview_p.h @@ -56,7 +56,7 @@ #include <QtQml/QQmlParserStatus> #include <QtQml/QQmlIncubator> #include <QtQml/qqml.h> -#include <QtQml/private/qqmldelegatemodel_p.h> +#include <private/qqmldelegatemodel_p.h> #include <QtQuick/private/qquicktransition_p.h> #include <QtLocation/private/qdeclarativegeomapitemgroup_p.h> diff --git a/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp b/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp index b594d2dc..aa1db493 100644 --- a/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp +++ b/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp @@ -192,7 +192,8 @@ void QDeclarativeGeoServiceProvider::componentComplete() || required_->mappingRequirements() != NoMappingFeatures || required_->routingRequirements() != NoRoutingFeatures || required_->geocodingRequirements() != NoGeocodingFeatures - || required_->placesRequirements() != NoPlacesFeatures) { + || required_->placesRequirements() != NoPlacesFeatures + || required_->navigationRequirements() != NoNavigationFeatures) { QStringList providers = QGeoServiceProvider::availableServiceProviders(); @@ -673,7 +674,8 @@ QDeclarativeGeoServiceProviderRequirements::QDeclarativeGeoServiceProviderRequir mapping_(QDeclarativeGeoServiceProvider::NoMappingFeatures), routing_(QDeclarativeGeoServiceProvider::NoRoutingFeatures), geocoding_(QDeclarativeGeoServiceProvider::NoGeocodingFeatures), - places_(QDeclarativeGeoServiceProvider::NoPlacesFeatures) + places_(QDeclarativeGeoServiceProvider::NoPlacesFeatures), + navigation_(QDeclarativeGeoServiceProvider::NoNavigationFeatures) { } @@ -769,6 +771,27 @@ void QDeclarativeGeoServiceProviderRequirements::setPlacesRequirements(const QDe /*! \internal */ +QDeclarativeGeoServiceProvider::NavigationFeatures QDeclarativeGeoServiceProviderRequirements::navigationRequirements() const +{ + return navigation_; +} + +/*! + \internal +*/ +void QDeclarativeGeoServiceProviderRequirements::setNavigationRequirements(const QDeclarativeGeoServiceProvider::NavigationFeatures &features) +{ + if (navigation_ == features) + return; + + navigation_ = features; + emit navigationRequirementsChanged(navigation_); + emit requirementsChanged(); +} + +/*! + \internal +*/ bool QDeclarativeGeoServiceProviderRequirements::matches(const QGeoServiceProvider *provider) const { QGeoServiceProvider::MappingFeatures mapping = @@ -817,13 +840,25 @@ bool QDeclarativeGeoServiceProviderRequirements::matches(const QGeoServiceProvid return false; } + QGeoServiceProvider::NavigationFeatures navigation = + static_cast<QGeoServiceProvider::NavigationFeatures>(int(navigation_)); + + if (navigation == QGeoServiceProvider::AnyNavigationFeatures) { + if (provider->navigationFeatures() == QGeoServiceProvider::NoNavigationFeatures) + return false; + } else { + if ((provider->navigationFeatures() & navigation) != navigation) + return false; + } + return true; } bool QDeclarativeGeoServiceProviderRequirements::operator == (const QDeclarativeGeoServiceProviderRequirements &rhs) const { return (mapping_ == rhs.mapping_ && routing_ == rhs.routing_ - && geocoding_ == rhs.geocoding_ && places_ == rhs.places_); + && geocoding_ == rhs.geocoding_ && places_ == rhs.places_ + && navigation_ == rhs.navigation_); } /******************************************************************************* diff --git a/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h b/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h index f6a663f3..3d5592c0 100644 --- a/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h +++ b/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h @@ -257,6 +257,9 @@ class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoServiceProviderRequirements : pub Q_PROPERTY(QDeclarativeGeoServiceProvider::PlacesFeatures places READ placesRequirements WRITE setPlacesRequirements NOTIFY placesRequirementsChanged) + Q_PROPERTY(QDeclarativeGeoServiceProvider::NavigationFeatures navigation + READ navigationRequirements WRITE setNavigationRequirements + NOTIFY navigationRequirementsChanged) public: explicit QDeclarativeGeoServiceProviderRequirements(QObject *parent = 0); @@ -274,6 +277,9 @@ public: QDeclarativeGeoServiceProvider::PlacesFeatures placesRequirements() const; void setPlacesRequirements(const QDeclarativeGeoServiceProvider::PlacesFeatures &features); + QDeclarativeGeoServiceProvider::NavigationFeatures navigationRequirements() const; + void setNavigationRequirements(const QDeclarativeGeoServiceProvider::NavigationFeatures &features); + Q_INVOKABLE bool matches(const QGeoServiceProvider *provider) const; bool operator == (const QDeclarativeGeoServiceProviderRequirements &rhs) const; @@ -283,6 +289,7 @@ Q_SIGNALS: void routingRequirementsChanged(const QDeclarativeGeoServiceProvider::RoutingFeatures &features); void geocodingRequirementsChanged(const QDeclarativeGeoServiceProvider::GeocodingFeatures &features); void placesRequirementsChanged(const QDeclarativeGeoServiceProvider::PlacesFeatures &features); + void navigationRequirementsChanged(const QDeclarativeGeoServiceProvider::NavigationFeatures &features); void requirementsChanged(); @@ -291,7 +298,7 @@ private: QDeclarativeGeoServiceProvider::RoutingFeatures routing_; QDeclarativeGeoServiceProvider::GeocodingFeatures geocoding_; QDeclarativeGeoServiceProvider::PlacesFeatures places_; - + QDeclarativeGeoServiceProvider::NavigationFeatures navigation_; }; QT_END_NAMESPACE diff --git a/src/location/declarativeplaces/qdeclarativeplace.cpp b/src/location/declarativeplaces/qdeclarativeplace.cpp index 89027d0e..74a8f0c0 100644 --- a/src/location/declarativeplaces/qdeclarativeplace.cpp +++ b/src/location/declarativeplaces/qdeclarativeplace.cpp @@ -1085,7 +1085,7 @@ void QDeclarativePlace::pullExtendedAttributes() QStringList attributeTypes = m_src.extendedAttributeTypes(); foreach (const QString &attributeType, attributeTypes) { m_extendedAttributes->insert(attributeType, - qVariantFromValue(new QDeclarativePlaceAttribute(m_src.extendedAttribute(attributeType)))); + QVariant::fromValue(new QDeclarativePlaceAttribute(m_src.extendedAttribute(attributeType)))); } emit extendedAttributesChanged(); diff --git a/src/location/labs/qmapobjectview.cpp b/src/location/labs/qmapobjectview.cpp index 90234ea6..8cbf8ded 100644 --- a/src/location/labs/qmapobjectview.cpp +++ b/src/location/labs/qmapobjectview.cpp @@ -36,7 +36,7 @@ #include "qmapobjectview_p.h" #include "qmapobjectview_p_p.h" -#include <QtQml/private/qqmldelegatemodel_p.h> +#include <private/qqmldelegatemodel_p.h> #include <QtLocation/private/qgeomap_p.h> QT_BEGIN_NAMESPACE diff --git a/src/location/maps/qgeotiledmapscene.cpp b/src/location/maps/qgeotiledmapscene.cpp index a5f94c8d..a8bee156 100644 --- a/src/location/maps/qgeotiledmapscene.cpp +++ b/src/location/maps/qgeotiledmapscene.cpp @@ -495,7 +495,9 @@ void QGeoTiledMapRootNode::updateTiles(QGeoTiledMapTileContainerNode *root, cameraMatrix.lookAt(toVector3D(eye), toVector3D(center), toVector3D(d->m_cameraUp)); root->setMatrix(d->m_projectionMatrix * cameraMatrix); - const QSet<QGeoTileSpec> tilesInSG = QSet<QGeoTileSpec>::fromList(root->tiles.keys()); + QSet<QGeoTileSpec> tilesInSG; + for (auto it = root->tiles.cbegin(), end = root->tiles.cend(); it != end; ++it) + tilesInSG.insert(it.key()); const QSet<QGeoTileSpec> toRemove = tilesInSG - d->m_visibleTiles; const QSet<QGeoTileSpec> toAdd = d->m_visibleTiles - tilesInSG; @@ -640,7 +642,9 @@ QSGNode *QGeoTiledMapScene::updateSceneGraph(QSGNode *oldNode, QQuickWindow *win d->m_updatedTextures.clear(); } - const QSet<QGeoTileSpec> textures = QSet<QGeoTileSpec>::fromList(mapRoot->textures.keys()); + QSet<QGeoTileSpec> textures; + for (auto it = mapRoot->textures.cbegin(), end = mapRoot->textures.cend(); it != end; ++it) + textures.insert(it.key()); const QSet<QGeoTileSpec> toRemove = textures - d->m_visibleTiles; const QSet<QGeoTileSpec> toAdd = d->m_visibleTiles - textures; diff --git a/src/location/maps/qgeotilefetcher.cpp b/src/location/maps/qgeotilefetcher.cpp index b3f7021b..cfca57ac 100644 --- a/src/location/maps/qgeotilefetcher.cpp +++ b/src/location/maps/qgeotilefetcher.cpp @@ -43,6 +43,9 @@ #include "qgeotilespec_p.h" #include "qgeotiledmap_p.h" +#include <algorithm> +#include <iterator> + QT_BEGIN_NAMESPACE QGeoTileFetcher::QGeoTileFetcher(QGeoMappingManagerEngine *parent) @@ -75,7 +78,7 @@ void QGeoTileFetcher::updateTileRequests(const QSet<QGeoTileSpec> &tilesAdded, cancelTileRequests(tilesRemoved); - d->queue_ += tilesAdded.toList(); + std::copy(tilesAdded.cbegin(), tilesAdded.cend(), std::back_inserter(d->queue_)); if (d->enabled_ && initialized() && !d->queue_.isEmpty() && !d->timer_.isActive()) d->timer_.start(0, this); diff --git a/tests/auto/declarative_core/tst_plugin.qml b/tests/auto/declarative_core/tst_plugin.qml index 7b880f1d..23c1ff9f 100644 --- a/tests/auto/declarative_core/tst_plugin.qml +++ b/tests/auto/declarative_core/tst_plugin.qml @@ -54,6 +54,7 @@ Item { mapping: Plugin.OfflineMappingFeature; geocoding: Plugin.OfflineGeocodingFeature; places: Plugin.AnyPlacesFeatures; + navigation: Plugin.AnyNavigationFeatures; } } @@ -120,6 +121,7 @@ Item { verify(requiredPlugin.supportsMapping(requiredPlugin.required.mapping)) verify(requiredPlugin.supportsGeocoding(requiredPlugin.required.geocoding)) verify(requiredPlugin.supportsPlaces(requiredPlugin.required.places)) + verify(requiredPlugin.supportsNavigation(requiredPlugin.required.navigation)) } function test_placesFeatures() { diff --git a/tests/auto/geotestplugin/geotestplugin.json b/tests/auto/geotestplugin/geotestplugin.json index 52721715..f6218b67 100644 --- a/tests/auto/geotestplugin/geotestplugin.json +++ b/tests/auto/geotestplugin/geotestplugin.json @@ -14,6 +14,7 @@ "OfflinePlacesFeature", "SavePlaceFeature", "SaveCategoryFeature", - "SearchSuggestionsFeature" + "SearchSuggestionsFeature", + "OfflineNavigationFeature" ] } diff --git a/tests/auto/geotestplugin/qgeoserviceproviderplugin_test.h b/tests/auto/geotestplugin/qgeoserviceproviderplugin_test.h index c606fdb0..ac195d69 100644 --- a/tests/auto/geotestplugin/qgeoserviceproviderplugin_test.h +++ b/tests/auto/geotestplugin/qgeoserviceproviderplugin_test.h @@ -34,10 +34,10 @@ QT_USE_NAMESPACE -class QGeoServiceProviderFactoryTest: public QObject, public QGeoServiceProviderFactory +class QGeoServiceProviderFactoryTest: public QObject, public QGeoServiceProviderFactoryV2 { Q_OBJECT - Q_INTERFACES(QGeoServiceProviderFactory) + Q_INTERFACES(QGeoServiceProviderFactoryV2) Q_PLUGIN_METADATA(IID "org.qt-project.qt.geoservice.serviceproviderfactory/5.0" FILE "geotestplugin.json") diff --git a/tests/auto/geotestplugin/qplacemanagerengine_test.h b/tests/auto/geotestplugin/qplacemanagerengine_test.h index 7245ccf1..f015afe7 100644 --- a/tests/auto/geotestplugin/qplacemanagerengine_test.h +++ b/tests/auto/geotestplugin/qplacemanagerengine_test.h @@ -474,9 +474,12 @@ public: results.append(r); } } else if (!query.categories().isEmpty()) { - QSet<QPlaceCategory> categories = query.categories().toSet(); - foreach (const QPlace &place, m_places) { - if (place.categories().toSet().intersect(categories).isEmpty()) + const auto &categoryList = query.categories(); + const QSet<QPlaceCategory> categories(categoryList.cbegin(), categoryList.cend()); + for (const QPlace &place : qAsConst(m_places)) { + const auto &placeCategoryList = place.categories(); + const QSet<QPlaceCategory> placeCategories(placeCategoryList.cbegin(), placeCategoryList.cend()); + if (!placeCategories.intersects(categories)) continue; QPlaceResult r; diff --git a/tests/auto/utils/qlocationtestutils.cpp b/tests/auto/utils/qlocationtestutils.cpp index d6e77855..df595daa 100644 --- a/tests/auto/utils/qlocationtestutils.cpp +++ b/tests/auto/utils/qlocationtestutils.cpp @@ -46,8 +46,7 @@ QString QLocationTestUtils::addNmeaChecksumAndBreaks(const QString &sentence) int result = 0; for (int i=1; i<sentence.length()-1; i++) result ^= sentence[i].toLatin1(); - QString sum; - sum.sprintf("%02x", result); + const QString sum = QString::asprintf("%02x", result); return sentence + sum + "\r\n"; } |