summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2018-05-04 11:13:36 +0200
committerPaolo Angelelli <paolo.angelelli@qt.io>2018-05-04 11:13:45 +0200
commitd0166d20086086fc5c4a8e437ed83fd389ee8643 (patch)
tree1928c60e483465d4ef8218c801a008afedba99b7
parentd44838125389720e4352dd51ad1da02f4cb58dc8 (diff)
parent139414573ab27bd1df1b491aeb6003a6fc0d3d5d (diff)
downloadqtlocation-d0166d20086086fc5c4a8e437ed83fd389ee8643.tar.gz
Merge remote-tracking branch 'origin/5.11.0' into 5.11
Change-Id: I0bb00d16c891856cfbe1042ce166bbd156e9f41b
-rw-r--r--.gitmodules2
-rw-r--r--dist/changes-5.11.0116
m---------src/3rdparty/mapbox-gl-native0
-rw-r--r--src/imports/location/location.cpp9
-rw-r--r--src/imports/location/plugins.qmltypes62
-rw-r--r--src/imports/positioning/plugins.qmltypes2
-rw-r--r--src/location/declarativemaps/qdeclarativegeomaneuver_p.h2
-rw-r--r--src/location/declarativemaps/qdeclarativegeomap_p.h2
-rw-r--r--src/location/declarativemaps/qdeclarativegeomapitembase_p.h4
-rw-r--r--src/location/declarativemaps/qdeclarativegeoroute_p.h2
-rw-r--r--src/location/declarativemaps/qdeclarativegeoroutemodel.cpp2
-rw-r--r--src/location/declarativemaps/qdeclarativegeoroutemodel_p.h4
-rw-r--r--src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h2
-rw-r--r--src/location/declarativemaps/qdeclarativepolygonmapitem.cpp17
-rw-r--r--src/location/declarativemaps/qdeclarativepolygonmapitem_p.h8
-rw-r--r--src/location/declarativemaps/qdeclarativepolylinemapitem.cpp69
-rw-r--r--src/location/declarativemaps/qdeclarativepolylinemapitem_p.h27
-rw-r--r--src/location/declarativemaps/qgeomapobject.cpp5
-rw-r--r--src/location/doc/src/qtlocation-qml.qdoc2
-rw-r--r--src/location/doc/src/qtlocation.qdoc4
-rw-r--r--src/location/labs/qdeclarativenavigator.cpp12
-rw-r--r--src/location/labs/qgeotiledmaplabs.cpp150
-rw-r--r--src/location/labs/qgeotiledmaplabs_p.h2
-rw-r--r--src/location/labs/qmapcircleobject.cpp3
-rw-r--r--src/location/labs/qmapiconobject.cpp3
-rw-r--r--src/location/labs/qmapobjectview.cpp62
-rw-r--r--src/location/labs/qmappolygonobject.cpp3
-rw-r--r--src/location/labs/qmappolylineobject.cpp3
-rw-r--r--src/location/labs/qmaprouteobject.cpp3
-rw-r--r--src/location/labs/qsg/qgeomapobjectqsgsupport.cpp224
-rw-r--r--src/location/labs/qsg/qgeomapobjectqsgsupport_p.h92
-rw-r--r--src/location/labs/qsg/qmapcircleobjectqsg.cpp10
-rw-r--r--src/location/labs/qsg/qmapcircleobjectqsg_p_p.h5
-rw-r--r--src/location/labs/qsg/qmapiconobjectqsg.cpp25
-rw-r--r--src/location/labs/qsg/qmapiconobjectqsg_p_p.h5
-rw-r--r--src/location/labs/qsg/qmappolygonobjectqsg.cpp10
-rw-r--r--src/location/labs/qsg/qmappolygonobjectqsg_p_p.h5
-rw-r--r--src/location/labs/qsg/qmappolylineobjectqsg.cpp10
-rw-r--r--src/location/labs/qsg/qmappolylineobjectqsg_p_p.h5
-rw-r--r--src/location/labs/qsg/qmaprouteobjectqsg.cpp10
-rw-r--r--src/location/labs/qsg/qmaprouteobjectqsg_p_p.h5
-rw-r--r--src/location/labs/qsg/qqsgmapobject.cpp6
-rw-r--r--src/location/labs/qsg/qqsgmapobject_p.h8
-rw-r--r--src/location/maps/qgeomap_p.h2
-rw-r--r--src/location/maps/qgeomap_p_p.h2
-rw-r--r--src/location/maps/qgeoserviceprovider.cpp5
-rw-r--r--src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.cpp156
-rw-r--r--src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.h2
-rw-r--r--src/positioning/doc/snippets/doc_src_qtpositioning.qml2
-rw-r--r--src/positioning/doc/src/qtpositioning-qml.qdoc2
50 files changed, 759 insertions, 414 deletions
diff --git a/.gitmodules b/.gitmodules
index a5343bfd..22c3849d 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,4 +1,4 @@
[submodule "src/3rdparty/mapbox-gl-native"]
path = src/3rdparty/mapbox-gl-native
url = ../qtlocation-mapboxgl.git
- branch = upstream/qt-staging
+ branch = upstream/qt-staging-5.11.0
diff --git a/dist/changes-5.11.0 b/dist/changes-5.11.0
new file mode 100644
index 00000000..aae63987
--- /dev/null
+++ b/dist/changes-5.11.0
@@ -0,0 +1,116 @@
+Qt 5.11 introduces many new features and improvements as well as bugfixes
+over the 5.10.x series. For more details, refer to the online documentation
+included in this distribution. The documentation is also available online:
+
+http://doc.qt.io/qt-5/index.html
+
+The Qt version 5.11 series is binary compatible with the 5.10.x series.
+Applications compiled for 5.10 will continue to run with 5.11.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Qt 5.11.0 Changes *
+****************************************************************************
+
+QtLocation
+----------
+
+ - Qt.labs.location
+ * A new experimental QML plugin introduced, Qt.labs.location, which
+ offers two new categories of QML elements: Map Objects and the
+ Navigator type. Both are experimental, not supposed to work in every
+ setup (check documentation). This plugin can be disabled at configure
+ time, through the location-labs-plugin feature.
+ * Map objects are supposed to be QQuickItem-less equivalents of
+ Map Items. They are supposed to be easy to implement in plugins, and
+ to introduce minimal overhead. They come with a reference
+ implementation based on QSGNodes, that is supposed to work in all of the
+ currently offered raster based plugins.
+ At the present, the MapboxGL plugin does not offer map objects support.
+ * The Navigator type is a new QML api to expose turn-by-turn navigation
+ functions present in plugins. It requires a plugin supporting
+ one of the Navigation capabilities to actually work.
+ At the present, none of the open source plugins have these capabilities.
+
+ - MapParameter
+ * MapParameter type now deprecated and re-registered under the DynamicParameter
+ name.
+
+ - QGeoServiceProvider/QGeoServiceProviderFactory
+ * Added QGeoServiceProviderFactoryV2, capable of producing
+ QNavigationManagerEngine objects.
+ Note: QNavigationManagerEngine is private API.
+
+ - QGeoPath
+ * The path property changed type, from QList<QGeoCoordinate> to
+ QVariantList. This is binary-compatible with the previous release,
+ and source-compatible in QML.
+ It may, however, introduce source incompatibilities when using
+ the QObject property API in C++ (::property and ::setProperty), for
+ example in the generation of language bindings.
+ For the regular user-code, the use case was deemed as rare enough
+ (since QGeoShape has a public setter/getter for the path) to not cause
+ any problem.
+ As the beta phase passed without issues, this change was therefore left in place.
+
+ - QGeoRoute
+ * QGeoRoute, QGeoRouteSegment and QGeoManeuver private implementation are
+ now (privately) exported and can be subclassed in plugins to provide
+ custom private implementations.
+ * QGeoRouteRequest now allows to specify extra parameters in QVariantMap form.
+ * RouteQuery (QDeclarativeGeoRouteQuery) now allows to specify extra parameters
+ through Map/DynamicParameters.
+ * Added extended attributes to QGeoManeuver/QDeclarativeGeoManeuver.
+ * [QTBUG-64066] Introduced new Waypoint QML type, intended to replace
+ QGeoCoordinate as mean to specify waypoints in a RouteQuery.
+
+ - QPlace
+ * QPlace private implementation is now (privately) exported and can be
+ subclassed in plugins to provide custom private implementations.
+ * QPlaceContent::Type has a new value, CustomType.
+
+ - QDeclarativeGeoMap
+ * [QTBUG-66315] Fixed a crash calling Map.clearMapItems before Map is
+ initialized.
+ * Fixed MapGestureArea not emitting when controlled with scroll wheel.
+ * [QTBUG-66880] Fixed clearData not triggering scene update.
+ * [QTBUG-67580] Fixed crash in QQuickGeoMapGestureArea.
+ * [QTBUG-67759] Fixed crash when calling clearData at startup.
+
+ - Map Items
+ * [QTBUG-66758] Fixed re-set map items rendering stale geometry.
+ * [QTBUG-38459] Fixed the geometry of map items so that, if layers.enabled
+ is set to true, the scene graph renderer will not cut the items borders
+ anymore.
+ * [QTBUG-66692, QTBUG-66830] Fixed polyline geometry generation.
+ * [QTBUG-62086, QTBUG-65833] Fixed MapItemView not setting context data
+ upon item deletion.
+ * [QTBUG-67765] Fixed interaction with Map Items borders.
+
+ - Plugins
+ * Mapbox: Added OnlinePlacesFeature, PlaceRecommendationsFeature, SearchSuggestionsFeature
+ and LocalizedPlacesFeature.
+ * Mapbox: Added OnlineGeocodingFeature, ReverseGeocodingFeature and LocalizedGeocodingFeature.
+ * Mapbox/OSM: OSRM backend now returns extended attributes for the maneuvers, such as
+ bearing_before, bearing_after, instruction, type and modifier.
+ * Mapbox/OSM: OSRM backend now uses Waypoint's bearing when sending a route request.
+ * Mapbox/OSM: Added OSRM's {leg,step}_index extra attribute to QGeoManeuver.
+ * Mapbox: Supported Mapbox Directions API voice & banner instructions.
+ * MapboxGL: Added map margins support via 'margins' map parameter.
+ * HERE: the plugin now uses Waypoint's bearing when sending a route request.
+ * OSM: supported the query limit parameter in the nominatim backend.
+
+
+QtPositioning
+----------
+
+ * [QTBUG-65937] Metatype for QGeoPositionInfo is now declared and registered.
+ This change introduces a potential source incompatibility, as existing user code may
+ contain the type registration already.
diff --git a/src/3rdparty/mapbox-gl-native b/src/3rdparty/mapbox-gl-native
-Subproject 8c1be4ec01ef46bf453856531ebf53b48ce3dbe
+Subproject 74df5203628b47931b4edcb5e8fe352f40fe7df
diff --git a/src/imports/location/location.cpp b/src/imports/location/location.cpp
index 45b104b9..183d11d3 100644
--- a/src/imports/location/location.cpp
+++ b/src/imports/location/location.cpp
@@ -183,8 +183,15 @@ public:
// Register the 5.11 types
minor = 11;
- qmlRegisterType<QDeclarativeGeoWaypoint>(uri, major, minor, "Waypoint");
+ qmlRegisterType<QDeclarativeGeoManeuver, 11>(uri, major, minor, "RouteManeuver");
+ qmlRegisterType<QDeclarativeGeoMap, 11>(uri, major, minor, "Map");
+ qmlRegisterUncreatableType<QDeclarativeGeoMapItemBase, 11>(uri, major, minor, "GeoMapItemBase",
+ QStringLiteral("GeoMapItemBase is not intended instantiable by developer."));
qmlRegisterType<QDeclarativeGeoMapParameter>(uri, major, minor, "DynamicParameter");
+ qmlRegisterType<QDeclarativeGeoRoute, 11>(uri, major, minor, "Route");
+ qmlRegisterType<QDeclarativeGeoRouteQuery, 11>(uri, major, minor, "RouteQuery");
+ qmlRegisterType<QDeclarativeGeoServiceProvider, 11>(uri, major, minor, "Plugin");
+ qmlRegisterType<QDeclarativeGeoWaypoint>(uri, major, minor, "Waypoint");
// Register the latest Qt version as QML type version
qmlRegisterModule(uri, QT_VERSION_MAJOR, QT_VERSION_MINOR);
diff --git a/src/imports/location/plugins.qmltypes b/src/imports/location/plugins.qmltypes
index ed977c4a..d2d9030a 100644
--- a/src/imports/location/plugins.qmltypes
+++ b/src/imports/location/plugins.qmltypes
@@ -4,7 +4,7 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable QtLocation 5.10'
+// 'qmlplugindump -nonrelocatable QtLocation 5.11'
Module {
dependencies: ["QtQuick 2.8"]
@@ -108,9 +108,10 @@ Module {
prototype: "QObject"
exports: [
"QtLocation/RouteManeuver 5.0",
+ "QtLocation/RouteManeuver 5.11",
"QtLocation/RouteManeuver 5.8"
]
- exportMetaObjectRevisions: [0, 0]
+ exportMetaObjectRevisions: [0, 11, 0]
Enum {
name: "Direction"
values: {
@@ -136,14 +137,20 @@ Module {
Property { name: "distanceToNextInstruction"; type: "double"; isReadonly: true }
Property { name: "waypoint"; type: "QGeoCoordinate"; isReadonly: true }
Property { name: "waypointValid"; type: "bool"; isReadonly: true }
- Property { name: "extendedAttributes"; type: "QObject"; isReadonly: true; isPointer: true }
+ Property {
+ name: "extendedAttributes"
+ revision: 11
+ type: "QObject"
+ isReadonly: true
+ isPointer: true
+ }
}
Component {
name: "QDeclarativeGeoMap"
defaultProperty: "data"
prototype: "QQuickItem"
- exports: ["QtLocation/Map 5.0"]
- exportMetaObjectRevisions: [0]
+ exports: ["QtLocation/Map 5.0", "QtLocation/Map 5.11"]
+ exportMetaObjectRevisions: [0, 11]
Property { name: "gesture"; type: "QQuickGeoMapGestureArea"; isReadonly: true; isPointer: true }
Property { name: "plugin"; type: "QDeclarativeGeoServiceProvider"; isPointer: true }
Property { name: "minimumZoomLevel"; type: "double" }
@@ -236,7 +243,7 @@ Module {
name: "mapReadyChanged"
Parameter { name: "ready"; type: "bool" }
}
- Signal { name: "mapObjectsChanged" }
+ Signal { name: "mapObjectsChanged"; revision: 11 }
Method {
name: "setBearing"
Parameter { name: "bearing"; type: "double" }
@@ -333,6 +340,7 @@ Module {
name: "styleSheetChanged"
Parameter { name: "styleSheet"; type: "string" }
}
+ Signal { name: "copyrightsVisibleChanged" }
Method {
name: "copyrightsChanged"
Parameter { name: "copyrightsImage"; type: "QImage" }
@@ -350,11 +358,16 @@ Module {
name: "QDeclarativeGeoMapItemBase"
defaultProperty: "data"
prototype: "QQuickItem"
- exports: ["QtLocation/GeoMapItemBase 5.0"]
+ exports: [
+ "QtLocation/GeoMapItemBase 5.0",
+ "QtLocation/GeoMapItemBase 5.11"
+ ]
isCreatable: false
- exportMetaObjectRevisions: [0]
+ exportMetaObjectRevisions: [0, 11]
Property { name: "geoShape"; type: "QGeoShape"; isReadonly: true }
Signal { name: "mapItemOpacityChanged" }
+ Signal { name: "enterTransitionFinished"; revision: 11 }
+ Signal { name: "exitTransitionFinished"; revision: 11 }
}
Component {
name: "QDeclarativeGeoMapItemGroup"
@@ -375,8 +388,11 @@ Module {
Component {
name: "QDeclarativeGeoMapParameter"
prototype: "QGeoMapParameter"
- exports: ["QtLocation/MapParameter 5.9"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtLocation/DynamicParameter 5.11",
+ "QtLocation/MapParameter 5.9"
+ ]
+ exportMetaObjectRevisions: [0, 0]
Signal {
name: "completed"
Parameter { type: "QDeclarativeGeoMapParameter"; isPointer: true }
@@ -432,13 +448,20 @@ Module {
Component {
name: "QDeclarativeGeoRoute"
prototype: "QObject"
- exports: ["QtLocation/Route 5.0"]
- exportMetaObjectRevisions: [0]
+ exports: ["QtLocation/Route 5.0", "QtLocation/Route 5.11"]
+ exportMetaObjectRevisions: [0, 11]
Property { name: "bounds"; type: "QGeoRectangle"; isReadonly: true }
Property { name: "travelTime"; type: "int"; isReadonly: true }
Property { name: "distance"; type: "double"; isReadonly: true }
Property { name: "path"; type: "QJSValue" }
Property { name: "segments"; type: "QDeclarativeGeoRouteSegment"; isList: true; isReadonly: true }
+ Property {
+ name: "routeQuery"
+ revision: 11
+ type: "QDeclarativeGeoRouteQuery"
+ isReadonly: true
+ isPointer: true
+ }
}
Component {
name: "QDeclarativeGeoRouteModel"
@@ -490,8 +513,8 @@ Module {
name: "QDeclarativeGeoRouteQuery"
defaultProperty: "quickChildren"
prototype: "QObject"
- exports: ["QtLocation/RouteQuery 5.0"]
- exportMetaObjectRevisions: [0]
+ exports: ["QtLocation/RouteQuery 5.0", "QtLocation/RouteQuery 5.11"]
+ exportMetaObjectRevisions: [0, 11]
Enum {
name: "TravelMode"
values: {
@@ -591,9 +614,10 @@ Module {
Property { name: "waypoints"; type: "QVariantList" }
Property { name: "excludedAreas"; type: "QJSValue" }
Property { name: "featureTypes"; type: "QList<int>"; isReadonly: true }
+ Property { name: "extraParameters"; revision: 11; type: "QVariantMap"; isReadonly: true }
Property { name: "quickChildren"; type: "QObject"; isList: true; isReadonly: true }
Signal { name: "queryDetailsChanged" }
- Signal { name: "extraParametersChanged" }
+ Signal { name: "extraParametersChanged"; revision: 11 }
Method { name: "waypointObjects"; type: "QVariantList" }
Method {
name: "addWaypoint"
@@ -639,8 +663,8 @@ Module {
name: "QDeclarativeGeoServiceProvider"
defaultProperty: "parameters"
prototype: "QObject"
- exports: ["QtLocation/Plugin 5.0"]
- exportMetaObjectRevisions: [0]
+ exports: ["QtLocation/Plugin 5.0", "QtLocation/Plugin 5.11"]
+ exportMetaObjectRevisions: [0, 11]
Enum {
name: "RoutingFeature"
values: {
@@ -810,10 +834,11 @@ Module {
Method { name: "supportsPlaces"; type: "bool" }
Method {
name: "supportsNavigation"
+ revision: 11
type: "bool"
Parameter { name: "feature"; type: "NavigationFeature" }
}
- Method { name: "supportsNavigation"; type: "bool" }
+ Method { name: "supportsNavigation"; revision: 11; type: "bool" }
}
Component {
name: "QDeclarativeGeoServiceProviderParameter"
@@ -876,6 +901,7 @@ Module {
Property { name: "altitude"; type: "double" }
Property { name: "isValid"; type: "bool"; isReadonly: true }
Property { name: "bearing"; type: "double" }
+ Property { name: "metadata"; type: "QVariantMap"; isReadonly: true }
Property { name: "quickChildren"; type: "QObject"; isList: true; isReadonly: true }
Signal { name: "completed" }
Signal { name: "waypointDetailsChanged" }
diff --git a/src/imports/positioning/plugins.qmltypes b/src/imports/positioning/plugins.qmltypes
index d9791c6d..dab72802 100644
--- a/src/imports/positioning/plugins.qmltypes
+++ b/src/imports/positioning/plugins.qmltypes
@@ -4,7 +4,7 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable QtPositioning 5.10'
+// 'qmlplugindump -nonrelocatable QtPositioning 5.11'
Module {
dependencies: ["QtQuick 2.8"]
diff --git a/src/location/declarativemaps/qdeclarativegeomaneuver_p.h b/src/location/declarativemaps/qdeclarativegeomaneuver_p.h
index f321c133..4c79aa80 100644
--- a/src/location/declarativemaps/qdeclarativegeomaneuver_p.h
+++ b/src/location/declarativemaps/qdeclarativegeomaneuver_p.h
@@ -71,7 +71,7 @@ class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoManeuver : public QObject
Q_PROPERTY(qreal distanceToNextInstruction READ distanceToNextInstruction CONSTANT)
Q_PROPERTY(QGeoCoordinate waypoint READ waypoint CONSTANT)
Q_PROPERTY(bool waypointValid READ waypointValid CONSTANT)
- Q_PROPERTY(QObject *extendedAttributes READ extendedAttributes NOTIFY extendedAttributesChanged)
+ Q_PROPERTY(QObject *extendedAttributes READ extendedAttributes NOTIFY extendedAttributesChanged REVISION 11)
public:
enum Direction {
diff --git a/src/location/declarativemaps/qdeclarativegeomap_p.h b/src/location/declarativemaps/qdeclarativegeomap_p.h
index cb8fed08..7f1bf7ab 100644
--- a/src/location/declarativemaps/qdeclarativegeomap_p.h
+++ b/src/location/declarativemaps/qdeclarativegeomap_p.h
@@ -225,7 +225,7 @@ Q_SIGNALS:
void copyrightsChanged(const QImage &copyrightsImage);
void copyrightsChanged(const QString &copyrightsHtml);
void mapReadyChanged(bool ready);
- void mapObjectsChanged();
+ Q_REVISION(11) void mapObjectsChanged();
protected:
void mousePressEvent(QMouseEvent *event) override ;
diff --git a/src/location/declarativemaps/qdeclarativegeomapitembase_p.h b/src/location/declarativemaps/qdeclarativegeomapitembase_p.h
index 603bcafd..7a284e8a 100644
--- a/src/location/declarativemaps/qdeclarativegeomapitembase_p.h
+++ b/src/location/declarativemaps/qdeclarativegeomapitembase_p.h
@@ -132,8 +132,8 @@ public:
Q_SIGNALS:
void mapItemOpacityChanged();
- void enterTransitionFinished();
- void exitTransitionFinished();
+ Q_REVISION(11) void enterTransitionFinished();
+ Q_REVISION(11) void exitTransitionFinished();
protected Q_SLOTS:
virtual void afterChildrenChanged();
diff --git a/src/location/declarativemaps/qdeclarativegeoroute_p.h b/src/location/declarativemaps/qdeclarativegeoroute_p.h
index 5fe29862..7e7ae368 100644
--- a/src/location/declarativemaps/qdeclarativegeoroute_p.h
+++ b/src/location/declarativemaps/qdeclarativegeoroute_p.h
@@ -67,7 +67,7 @@ class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoRoute : public QObject
Q_PROPERTY(qreal distance READ distance CONSTANT)
Q_PROPERTY(QJSValue path READ path WRITE setPath NOTIFY pathChanged)
Q_PROPERTY(QQmlListProperty<QDeclarativeGeoRouteSegment> segments READ segments CONSTANT)
- Q_PROPERTY(QDeclarativeGeoRouteQuery *routeQuery READ routeQuery)
+ Q_PROPERTY(QDeclarativeGeoRouteQuery *routeQuery READ routeQuery REVISION 11)
public:
explicit QDeclarativeGeoRoute(QObject *parent = 0);
diff --git a/src/location/declarativemaps/qdeclarativegeoroutemodel.cpp b/src/location/declarativemaps/qdeclarativegeoroutemodel.cpp
index 0f0bb253..4ddd1f5b 100644
--- a/src/location/declarativemaps/qdeclarativegeoroutemodel.cpp
+++ b/src/location/declarativemaps/qdeclarativegeoroutemodel.cpp
@@ -1826,8 +1826,6 @@ void QDeclarativeGeoWaypoint::setBearing(qreal bearing)
defined by the user, these can be set by using MapParameters.
If the waypoint comes from the engine via signals, or as part of a read-only route query,
the waypoint is intended to be read-only.
-
- \since 5.11
*/
QVariantMap QDeclarativeGeoWaypoint::metadata()
{
diff --git a/src/location/declarativemaps/qdeclarativegeoroutemodel_p.h b/src/location/declarativemaps/qdeclarativegeoroutemodel_p.h
index 64c1ebf8..afffc21a 100644
--- a/src/location/declarativemaps/qdeclarativegeoroutemodel_p.h
+++ b/src/location/declarativemaps/qdeclarativegeoroutemodel_p.h
@@ -295,7 +295,7 @@ class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoRouteQuery : public QObject, publ
Q_PROPERTY(QVariantList waypoints READ waypoints WRITE setWaypoints NOTIFY waypointsChanged)
Q_PROPERTY(QJSValue excludedAreas READ excludedAreas WRITE setExcludedAreas NOTIFY excludedAreasChanged)
Q_PROPERTY(QList<int> featureTypes READ featureTypes NOTIFY featureTypesChanged)
- Q_PROPERTY(QVariantMap extraParameters READ extraParameters)
+ Q_PROPERTY(QVariantMap extraParameters READ extraParameters REVISION 11)
Q_PROPERTY(QQmlListProperty<QObject> quickChildren READ declarativeChildren DESIGNABLE false)
Q_CLASSINFO("DefaultProperty", "quickChildren")
Q_INTERFACES(QQmlParserStatus)
@@ -434,7 +434,7 @@ Q_SIGNALS:
void segmentDetailChanged();
void queryDetailsChanged();
- void extraParametersChanged();
+ Q_REVISION(11) void extraParametersChanged();
private Q_SLOTS:
void excludedAreaCoordinateChanged();
diff --git a/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h b/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h
index 13768411..f6a663f3 100644
--- a/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h
+++ b/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h
@@ -206,7 +206,7 @@ public:
Q_INVOKABLE bool supportsGeocoding(const GeocodingFeatures &feature = AnyGeocodingFeatures) const;
Q_INVOKABLE bool supportsMapping(const MappingFeatures &feature = AnyMappingFeatures) const;
Q_INVOKABLE bool supportsPlaces(const PlacesFeatures &feature = AnyPlacesFeatures) const;
- Q_INVOKABLE bool supportsNavigation(const NavigationFeature &feature = AnyNavigationFeatures) const;
+ Q_REVISION(11) Q_INVOKABLE bool supportsNavigation(const NavigationFeature &feature = AnyNavigationFeatures) const;
QStringList locales() const;
void setLocales(const QStringList &locales);
diff --git a/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp b/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp
index 9e96f3c6..eab0f214 100644
--- a/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp
+++ b/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp
@@ -654,8 +654,7 @@ void QDeclarativePolygonMapItem::geometryChanged(const QRectF &newGeometry, cons
MapPolygonNode::MapPolygonNode() :
border_(new MapPolylineNode()),
- geometry_(QSGGeometry::defaultAttributes_Point2D(), 0),
- blocked_(true)
+ geometry_(QSGGeometry::defaultAttributes_Point2D(), 0)
{
geometry_.setDrawingMode(QSGGeometry::DrawTriangles);
QSGGeometryNode::setMaterial(&fill_material_);
@@ -671,14 +670,6 @@ MapPolygonNode::~MapPolygonNode()
/*!
\internal
*/
-bool MapPolygonNode::isSubtreeBlocked() const
-{
- return blocked_;
-}
-
-/*!
- \internal
-*/
void MapPolygonNode::update(const QColor &fillColor, const QColor &borderColor,
const QGeoMapItemGeometry *fillShape,
const QGeoMapItemGeometry *borderShape)
@@ -692,13 +683,13 @@ void MapPolygonNode::update(const QColor &fillColor, const QColor &borderColor,
* accuracy) */
if (fillShape->size() == 0) {
if (borderShape->size() == 0) {
- blocked_ = true;
+ setSubtreeBlocked(true);
return;
} else {
- blocked_ = false;
+ setSubtreeBlocked(false);
}
} else {
- blocked_ = false;
+ setSubtreeBlocked(false);
}
QSGGeometry *fill = QSGGeometryNode::geometry();
diff --git a/src/location/declarativemaps/qdeclarativepolygonmapitem_p.h b/src/location/declarativemaps/qdeclarativepolygonmapitem_p.h
index febeb751..83983651 100644
--- a/src/location/declarativemaps/qdeclarativepolygonmapitem_p.h
+++ b/src/location/declarativemaps/qdeclarativepolygonmapitem_p.h
@@ -137,24 +137,20 @@ private:
//////////////////////////////////////////////////////////////////////
-class Q_LOCATION_PRIVATE_EXPORT MapPolygonNode : public QSGGeometryNode
+class Q_LOCATION_PRIVATE_EXPORT MapPolygonNode : public MapItemGeometryNode
{
public:
MapPolygonNode();
- ~MapPolygonNode();
+ ~MapPolygonNode() override;
void update(const QColor &fillColor, const QColor &borderColor,
const QGeoMapItemGeometry *fillShape,
const QGeoMapItemGeometry *borderShape);
-
- bool isSubtreeBlocked() const override;
-
private:
QSGFlatColorMaterial fill_material_;
MapPolylineNode *border_;
QSGGeometry geometry_;
- bool blocked_;
};
QT_END_NAMESPACE
diff --git a/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp b/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
index c880ab00..2dab58e9 100644
--- a/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
+++ b/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp
@@ -1013,29 +1013,76 @@ QGeoMap::ItemType QDeclarativePolylineMapItem::itemType() const
/*!
\internal
*/
-MapPolylineNode::MapPolylineNode() :
- geometry_(QSGGeometry::defaultAttributes_Point2D(),0),
- blocked_(true)
+VisibleNode::VisibleNode() : m_blocked{true}, m_visible{true}
{
- geometry_.setDrawingMode(QSGGeometry::DrawTriangleStrip);
- QSGGeometryNode::setMaterial(&fill_material_);
- QSGGeometryNode::setGeometry(&geometry_);
+
}
+VisibleNode::~VisibleNode()
+{
+
+}
/*!
\internal
*/
-MapPolylineNode::~MapPolylineNode()
+bool VisibleNode::subtreeBlocked() const
+{
+ return m_blocked || !m_visible;
+}
+
+/*!
+ \internal
+*/
+void VisibleNode::setSubtreeBlocked(bool blocked)
+{
+ m_blocked = blocked;
+}
+
+bool VisibleNode::visible() const
+{
+ return m_visible;
+}
+
+/*!
+ \internal
+*/
+void VisibleNode::setVisible(bool visible)
{
+ m_visible = visible;
}
/*!
\internal
*/
-bool MapPolylineNode::isSubtreeBlocked() const
+MapItemGeometryNode::~MapItemGeometryNode()
+{
+
+}
+
+bool MapItemGeometryNode::isSubtreeBlocked() const
+{
+ return subtreeBlocked();
+}
+
+
+/*!
+ \internal
+*/
+MapPolylineNode::MapPolylineNode() :
+ geometry_(QSGGeometry::defaultAttributes_Point2D(),0)
+{
+ geometry_.setDrawingMode(QSGGeometry::DrawTriangleStrip);
+ QSGGeometryNode::setMaterial(&fill_material_);
+ QSGGeometryNode::setGeometry(&geometry_);
+}
+
+
+/*!
+ \internal
+*/
+MapPolylineNode::~MapPolylineNode()
{
- return blocked_;
}
/*!
@@ -1045,10 +1092,10 @@ void MapPolylineNode::update(const QColor &fillColor,
const QGeoMapItemGeometry *shape)
{
if (shape->size() == 0) {
- blocked_ = true;
+ setSubtreeBlocked(true);
return;
} else {
- blocked_ = false;
+ setSubtreeBlocked(false);
}
QSGGeometry *fill = QSGGeometryNode::geometry();
diff --git a/src/location/declarativemaps/qdeclarativepolylinemapitem_p.h b/src/location/declarativemaps/qdeclarativepolylinemapitem_p.h
index ca01de12..225f21d9 100644
--- a/src/location/declarativemaps/qdeclarativepolylinemapitem_p.h
+++ b/src/location/declarativemaps/qdeclarativepolylinemapitem_p.h
@@ -181,20 +181,39 @@ private:
//////////////////////////////////////////////////////////////////////
-class Q_LOCATION_PRIVATE_EXPORT MapPolylineNode : public QSGGeometryNode
+class Q_LOCATION_PRIVATE_EXPORT VisibleNode
{
+public:
+ VisibleNode();
+ virtual ~VisibleNode();
+
+ bool subtreeBlocked() const;
+ void setSubtreeBlocked(bool blocked);
+ bool visible() const;
+ void setVisible(bool visible);
+
+ bool m_blocked : 1;
+ bool m_visible : 1;
+};
+class Q_LOCATION_PRIVATE_EXPORT MapItemGeometryNode : public QSGGeometryNode, public VisibleNode
+{
+public:
+ ~MapItemGeometryNode() override;
+ bool isSubtreeBlocked() const override;
+};
+
+class Q_LOCATION_PRIVATE_EXPORT MapPolylineNode : public MapItemGeometryNode
+{
public:
MapPolylineNode();
- ~MapPolylineNode();
+ ~MapPolylineNode() override;
void update(const QColor &fillColor, const QGeoMapItemGeometry *shape);
- bool isSubtreeBlocked() const override;
private:
QSGFlatColorMaterial fill_material_;
QSGGeometry geometry_;
- bool blocked_;
};
QT_END_NAMESPACE
diff --git a/src/location/declarativemaps/qgeomapobject.cpp b/src/location/declarativemaps/qgeomapobject.cpp
index 391ac04c..9a2e37bd 100644
--- a/src/location/declarativemaps/qgeomapobject.cpp
+++ b/src/location/declarativemaps/qgeomapobject.cpp
@@ -198,8 +198,8 @@ void QGeoMapObject::setMap(QGeoMap *map)
// old implementation gets destroyed if/when d_ptr gets replaced
d_ptr->m_componentCompleted = oldCmponentCompleted;
d_ptr->setVisible(oldVisible);
+ d_ptr->setMap(map);
}
- d_ptr->setMap(map);
const QList<QGeoMapObject *> kids = geoMapObjectChildren();
for (auto kid : kids)
@@ -207,7 +207,8 @@ void QGeoMapObject::setMap(QGeoMap *map)
// Each subclass is in charge to do the equivalent of
// if (!map) {
- // // Map was set, now it has ben re-set to NULL
+ // // Map was set, now it has ben re-set to NULL, but not inside d_ptr.
+ // // so m_map inside d_ptr can still be used to remove itself, inside the destructor.
// d_ptr = new QMapCircleObjectPrivateDefault(*d);
// // Old pimpl deleted implicitly by QExplicitlySharedDataPointer
// }
diff --git a/src/location/doc/src/qtlocation-qml.qdoc b/src/location/doc/src/qtlocation-qml.qdoc
index c0879d2d..38f43ef1 100644
--- a/src/location/doc/src/qtlocation-qml.qdoc
+++ b/src/location/doc/src/qtlocation-qml.qdoc
@@ -26,7 +26,7 @@
****************************************************************************/
/*!
- \qmlmodule QtLocation 5.3
+ \qmlmodule QtLocation 5.11
\title Qt Location QML Types
\ingroup qmlmodules
\brief Provides QML types for mapping and location information
diff --git a/src/location/doc/src/qtlocation.qdoc b/src/location/doc/src/qtlocation.qdoc
index 96564ecb..1f27a14a 100644
--- a/src/location/doc/src/qtlocation.qdoc
+++ b/src/location/doc/src/qtlocation.qdoc
@@ -84,8 +84,8 @@ The Qt Location API enables you to:
To load the Qt Location module, add the following statement to your .qml files
\code
- import QtPositioning 5.5
- import QtLocation 5.6
+ import QtPositioning 5.11
+ import QtLocation 5.11
\endcode
The QtLocation QML module depends on the QtPositioning QML module.
diff --git a/src/location/labs/qdeclarativenavigator.cpp b/src/location/labs/qdeclarativenavigator.cpp
index 475cb650..bcb74c90 100644
--- a/src/location/labs/qdeclarativenavigator.cpp
+++ b/src/location/labs/qdeclarativenavigator.cpp
@@ -312,10 +312,8 @@ void QDeclarativeNavigator::start()
return;
}
- if (d_ptr->m_active)
- return;
-
- d_ptr->m_active = d_ptr->m_navigationManager->start();
+ if (!d_ptr->m_navigationManager->active())
+ d_ptr->m_active = d_ptr->m_navigationManager->start();
}
void QDeclarativeNavigator::stop()
@@ -325,10 +323,8 @@ void QDeclarativeNavigator::stop()
return;
}
- if (!d_ptr->m_active)
- return;
-
- d_ptr->m_active = d_ptr->m_navigationManager->stop();
+ if (d_ptr->m_navigationManager->active())
+ d_ptr->m_active = d_ptr->m_navigationManager->stop();
}
void QDeclarativeNavigator::pluginReady()
diff --git a/src/location/labs/qgeotiledmaplabs.cpp b/src/location/labs/qgeotiledmaplabs.cpp
index 2e4b2c16..22d582c0 100644
--- a/src/location/labs/qgeotiledmaplabs.cpp
+++ b/src/location/labs/qgeotiledmaplabs.cpp
@@ -42,26 +42,20 @@
#include <QtLocation/private/qmapcircleobjectqsg_p_p.h>
#include <QtLocation/private/qmaprouteobjectqsg_p_p.h>
#include <QtLocation/private/qmapiconobjectqsg_p_p.h>
+#include <QtLocation/private/qdeclarativepolylinemapitem_p.h>
+#include <QtLocation/private/qgeomapobjectqsgsupport_p.h>
QT_BEGIN_NAMESPACE
-struct MapObject {
- MapObject(QPointer<QGeoMapObject> &o, QQSGMapObject *sgo)
- : object(o), sgObject(sgo) {}
- QPointer<QGeoMapObject> object;
- QQSGMapObject *sgObject = nullptr;
-};
-
class QGeoTiledMapLabsPrivate : public QGeoTiledMapPrivate
{
Q_DECLARE_PUBLIC(QGeoTiledMapLabs)
public:
- QGeoTiledMapLabsPrivate(QGeoTiledMappingManagerEngine *engine);
+ QGeoTiledMapLabsPrivate(QGeoTiledMappingManagerEngine *engine, QGeoTiledMapLabs *map);
virtual ~QGeoTiledMapLabsPrivate();
QGeoMapObjectPrivate *createMapObjectImplementation(QGeoMapObject *obj) override;
virtual QList<QGeoMapObject *> mapObjects() const override;
- static int findMapObject(QGeoMapObject *o, const QList<MapObject> &list);
void removeMapObject(QGeoMapObject *obj);
void updateMapObjects(QSGNode *root, QQuickWindow *window);
@@ -72,14 +66,13 @@ protected:
void changeCameraData(const QGeoCameraData &oldCameraData) override;
void changeActiveMapType(const QGeoMapType mapType) override;
- QList<MapObject> m_mapObjects;
- QList<MapObject> m_pendingMapObjects;
+ QGeoMapObjectQSGSupport m_qsgSupport;
};
-QGeoTiledMapLabsPrivate::QGeoTiledMapLabsPrivate(QGeoTiledMappingManagerEngine *engine)
+QGeoTiledMapLabsPrivate::QGeoTiledMapLabsPrivate(QGeoTiledMappingManagerEngine *engine, QGeoTiledMapLabs *map)
: QGeoTiledMapPrivate(engine)
{
-
+ m_qsgSupport.m_map = map;
}
QGeoTiledMapLabsPrivate::~QGeoTiledMapLabsPrivate()
@@ -89,136 +82,27 @@ QGeoTiledMapLabsPrivate::~QGeoTiledMapLabsPrivate()
QGeoMapObjectPrivate *QGeoTiledMapLabsPrivate::createMapObjectImplementation(QGeoMapObject *obj)
{
- switch (obj->type()) {
- case QGeoMapObject::PolylineType: {
- QMapPolylineObjectPrivate &oldImpl = static_cast<QMapPolylineObjectPrivate &>(*obj->implementation());
- QMapPolylineObjectPrivateQSG *pimpl =
- new QMapPolylineObjectPrivateQSG(oldImpl);
- QPointer<QGeoMapObject> p(obj);
- MapObject mo(p, pimpl);
- m_pendingMapObjects << mo;
- return pimpl;
- }
- case QGeoMapObject::PolygonType: {
- QMapPolygonObjectPrivate &oldImpl = static_cast<QMapPolygonObjectPrivate &>(*obj->implementation());
- QMapPolygonObjectPrivateQSG *pimpl =
- new QMapPolygonObjectPrivateQSG(oldImpl);
- QPointer<QGeoMapObject> p(obj);
- MapObject mo(p, pimpl);
- m_pendingMapObjects << mo;
- return pimpl;
- }
- case QGeoMapObject::CircleType: {
- QMapCircleObjectPrivate &oldImpl = static_cast<QMapCircleObjectPrivate &>(*obj->implementation());
- QMapCircleObjectPrivateQSG *pimpl =
- new QMapCircleObjectPrivateQSG(oldImpl);
- QPointer<QGeoMapObject> p(obj);
- MapObject mo(p, pimpl);
- m_pendingMapObjects << mo;
- return pimpl;
- }
- case QGeoMapObject::RouteType: {
- QMapRouteObjectPrivate &oldImpl = static_cast<QMapRouteObjectPrivate &>(*obj->implementation());
- QMapRouteObjectPrivateQSG *pimpl =
- new QMapRouteObjectPrivateQSG(oldImpl);
- QPointer<QGeoMapObject> p(obj);
- MapObject mo(p, pimpl);
- m_pendingMapObjects << mo;
- return pimpl;
- }
- case QGeoMapObject::IconType: {
- QMapIconObjectPrivate &oldImpl = static_cast<QMapIconObjectPrivate &>(*obj->implementation());
- QMapIconObjectPrivateQSG *pimpl =
- new QMapIconObjectPrivateQSG(oldImpl);
- QPointer<QGeoMapObject> p(obj);
- MapObject mo(p, pimpl);
- m_pendingMapObjects << mo;
- return pimpl;
- }
- default:
- qWarning() << "Unsupported object type: " << obj->type();
- break;
- }
- return nullptr;
+ return m_qsgSupport.createMapObjectImplementationPrivate(obj);
}
QList<QGeoMapObject *> QGeoTiledMapLabsPrivate::mapObjects() const
{
- return QList<QGeoMapObject *>();
-}
-
-int QGeoTiledMapLabsPrivate::findMapObject(QGeoMapObject *o, const QList<MapObject> &list)
-{
- for (int i = 0; i < list.size(); ++i)
- {
- if (list.at(i).object.data() == o)
- return i;
- }
- return -1;
+ return m_qsgSupport.mapObjects();
}
void QGeoTiledMapLabsPrivate::removeMapObject(QGeoMapObject *obj)
{
- int idx = findMapObject(obj, m_mapObjects);
- if (idx >= 0) {
- m_mapObjects.removeAt(idx);
- } else {
- idx = findMapObject(obj, m_pendingMapObjects);
- if (idx >= 0) {
- m_pendingMapObjects.removeAt(idx);
- } else {
- // obj not here.
- }
- }
+ m_qsgSupport.removeMapObject(obj);
}
void QGeoTiledMapLabsPrivate::updateMapObjects(QSGNode *root, QQuickWindow *window)
{
- for (int i = 0; i < m_mapObjects.size(); ++i) {
- // already added as node
- if (!m_mapObjects.at(i).object) {
- qWarning() << "m_mapObjects at "<<i<< " NULLed!!";
- continue;
- }
-
- QQSGMapObject *sgo = m_mapObjects.at(i).sgObject;
- QSGNode *oldNode = sgo->node;
- sgo->node = sgo->updateMapObjectNode(oldNode, root, window);
- }
-
- QList<int> toRemove;
- for (int i = 0; i < m_pendingMapObjects.size(); ++i) {
- // already added as node
- QQSGMapObject *sgo = m_pendingMapObjects.at(i).sgObject;
- QSGNode *oldNode = sgo->node;
- sgo->updateGeometry(); // or subtree will be blocked
- sgo->node = sgo->updateMapObjectNode(oldNode, root, window);
- if (sgo->node) {
- m_mapObjects << m_pendingMapObjects.at(i);
- toRemove.push_front(i);
- } else {
- // leave it to be processed
- }
- }
-
- for (int i: qAsConst(toRemove))
- m_pendingMapObjects.removeAt(i);
+ m_qsgSupport.updateMapObjects(root, window);
}
void QGeoTiledMapLabsPrivate::updateObjectsGeometry()
{
- Q_Q(QGeoTiledMapLabs);
- for (int i = 0; i < m_mapObjects.size(); ++i) {
- // already added as node
- if (!m_mapObjects.at(i).object) {
- qWarning() << "m_mapObjects at "<<i<< " NULLed!!";
- continue;
- }
-
- QQSGMapObject *sgo = m_mapObjects.at(i).sgObject;
- sgo->updateGeometry();
- }
- emit q->sgNodeChanged();
+ m_qsgSupport.updateObjectsGeometry();
}
void QGeoTiledMapLabsPrivate::changeViewportSize(const QSize &size)
@@ -247,7 +131,7 @@ void QGeoTiledMapLabsPrivate::changeActiveMapType(const QGeoMapType mapType)
QGeoTiledMapLabs::QGeoTiledMapLabs(QGeoTiledMappingManagerEngine *engine, QObject *parent)
- : QGeoTiledMap(*new QGeoTiledMapLabsPrivate(engine), engine, parent)
+ : QGeoTiledMap(*new QGeoTiledMapLabsPrivate(engine, this), engine, parent)
{
}
@@ -260,15 +144,7 @@ QGeoTiledMapLabs::~QGeoTiledMapLabs()
bool QGeoTiledMapLabs::createMapObjectImplementation(QGeoMapObject *obj)
{
Q_D(QGeoTiledMapLabs);
- QExplicitlySharedDataPointer<QGeoMapObjectPrivate> pimpl =
- QExplicitlySharedDataPointer<QGeoMapObjectPrivate>(d->createMapObjectImplementation(obj));
- if (pimpl.constData()) {
- bool res = obj->setImplementation(pimpl);
- if (res)
- emit sgNodeChanged();
- return res;
- }
- return false;
+ return d->m_qsgSupport.createMapObjectImplementation(obj, d);
}
QSGNode *QGeoTiledMapLabs::updateSceneGraph(QSGNode *node, QQuickWindow *window)
diff --git a/src/location/labs/qgeotiledmaplabs_p.h b/src/location/labs/qgeotiledmaplabs_p.h
index f6499784..4f179028 100644
--- a/src/location/labs/qgeotiledmaplabs_p.h
+++ b/src/location/labs/qgeotiledmaplabs_p.h
@@ -71,10 +71,10 @@ public:
virtual ~QGeoTiledMapLabs();
bool createMapObjectImplementation(QGeoMapObject *obj) override;
+ void removeMapObject(QGeoMapObject *obj) override;
protected:
QSGNode *updateSceneGraph(QSGNode *node, QQuickWindow *window) override;
- void removeMapObject(QGeoMapObject *obj) override;
QSGClipNode *m_clip = nullptr;
QSGSimpleRectNode *m_simpleRectNode = nullptr;
diff --git a/src/location/labs/qmapcircleobject.cpp b/src/location/labs/qmapcircleobject.cpp
index 735ece5c..d7f1d58f 100644
--- a/src/location/labs/qmapcircleobject.cpp
+++ b/src/location/labs/qmapcircleobject.cpp
@@ -278,7 +278,8 @@ void QMapCircleObject::setMap(QGeoMap *map)
QGeoMapObject::setMap(map); // This is where the specialized pimpl gets created and injected
if (!map) {
- // Map was set, now it has ben re-set to NULL
+ // Map was set, now it has ben re-set to NULL, but not inside d_ptr.
+ // so m_map inside d_ptr can still be used to remove itself, inside the destructor.
d_ptr = new QMapCircleObjectPrivateDefault(*d);
// Old pimpl deleted implicitly by QExplicitlySharedDataPointer
}
diff --git a/src/location/labs/qmapiconobject.cpp b/src/location/labs/qmapiconobject.cpp
index 507492d2..be82ebbf 100644
--- a/src/location/labs/qmapiconobject.cpp
+++ b/src/location/labs/qmapiconobject.cpp
@@ -236,7 +236,8 @@ void QMapIconObject::setMap(QGeoMap *map)
QGeoMapObject::setMap(map); // This is where the specialized pimpl gets created and injected
if (!map) {
- // Map was set, now it has ben re-set to NULL
+ // Map was set, now it has ben re-set to NULL, but not inside d_ptr.
+ // so m_map inside d_ptr can still be used to remove itself, inside the destructor.
d_ptr = new QMapIconObjectPrivateDefault(*d);
// Old pimpl deleted implicitly by QExplicitlySharedDataPointer
}
diff --git a/src/location/labs/qmapobjectview.cpp b/src/location/labs/qmapobjectview.cpp
index e1161acd..175e7cc4 100644
--- a/src/location/labs/qmapobjectview.cpp
+++ b/src/location/labs/qmapobjectview.cpp
@@ -144,37 +144,6 @@ QList<QGeoMapObject *> QMapObjectView::geoMapObjectChildren() const
return kids;
}
-void QMapObjectView::setMap(QGeoMap *map)
-{
- QMapObjectViewPrivate *d = static_cast<QMapObjectViewPrivate *>(d_ptr.data());
- if (d->m_map == map)
- return;
-
- QGeoMapObject::setMap(map); // This is where the specialized pimpl gets created and injected
-
- for (int i = 0; i < m_userAddedMapObjects.size(); ++i) {
- auto obj = m_userAddedMapObjects.at(i);
- if (obj && obj->map() != map)
- obj->setMap(map);
- }
-
- if (!map) {
- // Map was set, now it has ben re-set to NULL
- flushDelegateModel();
- flushUserAddedMapObjects();
- d_ptr = new QMapObjectViewPrivateDefault(*d);
- } else if (d->m_componentCompleted) {
- // Map was null, now it's set AND delegateModel is already complete.
- // some delegates may have been incubated but not added to the map.
- for (int i = 0; i < m_pendingMapObjects.size(); ++i) {
- auto obj = m_pendingMapObjects.at(i);
- if (obj && obj->map() != map)
- obj->setMap(map);
- }
- m_pendingMapObjects.clear();
- }
-}
-
void QMapObjectView::classBegin()
{
QQmlContext *ctx = qmlContext(this);
@@ -381,5 +350,36 @@ void QMapObjectView::flushUserAddedMapObjects()
}
}
+void QMapObjectView::setMap(QGeoMap *map)
+{
+ QMapObjectViewPrivate *d = static_cast<QMapObjectViewPrivate *>(d_ptr.data());
+ if (d->m_map == map)
+ return;
+
+ QGeoMapObject::setMap(map); // This is where the specialized pimpl gets created and injected
+
+ for (int i = 0; i < m_userAddedMapObjects.size(); ++i) {
+ auto obj = m_userAddedMapObjects.at(i);
+ if (obj && obj->map() != map)
+ obj->setMap(map);
+ }
+
+ if (!map) {
+ // Map was set, now it has ben re-set to NULL
+ flushDelegateModel();
+ flushUserAddedMapObjects();
+ d_ptr = new QMapObjectViewPrivateDefault(*d);
+ } else if (d->m_componentCompleted) {
+ // Map was null, now it's set AND delegateModel is already complete.
+ // some delegates may have been incubated but not added to the map.
+ for (int i = 0; i < m_pendingMapObjects.size(); ++i) {
+ auto obj = m_pendingMapObjects.at(i);
+ if (obj && obj->map() != map)
+ obj->setMap(map);
+ }
+ m_pendingMapObjects.clear();
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/location/labs/qmappolygonobject.cpp b/src/location/labs/qmappolygonobject.cpp
index adc3259f..1d495899 100644
--- a/src/location/labs/qmappolygonobject.cpp
+++ b/src/location/labs/qmappolygonobject.cpp
@@ -246,7 +246,8 @@ void QMapPolygonObject::setMap(QGeoMap *map)
QGeoMapObject::setMap(map); // This is where the specialized pimpl gets created and injected
if (!map) {
- // Map was set, now it has ben re-set to NULL
+ // Map was set, now it has ben re-set to NULL, but not inside d_ptr.
+ // so m_map inside d_ptr can still be used to remove itself, inside the destructor.
d_ptr = new QMapPolygonObjectPrivateDefault(*d);
// Old pimpl deleted implicitly by QExplicitlySharedDataPointer
}
diff --git a/src/location/labs/qmappolylineobject.cpp b/src/location/labs/qmappolylineobject.cpp
index bea79327..1c351962 100644
--- a/src/location/labs/qmappolylineobject.cpp
+++ b/src/location/labs/qmappolylineobject.cpp
@@ -209,7 +209,8 @@ void QMapPolylineObject::setMap(QGeoMap *map)
QGeoMapObject::setMap(map); // This is where the specialized pimpl gets created and injected
if (!map) {
- // Map was set, now it has ben re-set to NULL
+ // Map was set, now it has ben re-set to NULL, but not inside d_ptr.
+ // so m_map inside d_ptr can still be used to remove itself, inside the destructor.
d_ptr = new QMapPolylineObjectPrivateDefault(*d);
// Old pimpl deleted implicitly by QExplicitlySharedDataPointer
}
diff --git a/src/location/labs/qmaprouteobject.cpp b/src/location/labs/qmaprouteobject.cpp
index 7e36322c..c3365d30 100644
--- a/src/location/labs/qmaprouteobject.cpp
+++ b/src/location/labs/qmaprouteobject.cpp
@@ -170,7 +170,8 @@ void QMapRouteObject::setMap(QGeoMap *map)
QGeoMapObject::setMap(map); // This is where the specialized pimpl gets created and injected
if (!map) {
- // Map was set, now it has ben re-set to NULL
+ // Map was set, now it has ben re-set to NULL, but not inside d_ptr.
+ // so m_map inside d_ptr can still be used to remove itself, inside the destructor.
d_ptr = new QMapRouteObjectPrivate(*d);
// Old pimpl deleted implicitly by QExplicitlySharedDataPointer
}
diff --git a/src/location/labs/qsg/qgeomapobjectqsgsupport.cpp b/src/location/labs/qsg/qgeomapobjectqsgsupport.cpp
new file mode 100644
index 00000000..e0e3a6d7
--- /dev/null
+++ b/src/location/labs/qsg/qgeomapobjectqsgsupport.cpp
@@ -0,0 +1,224 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgeomapobjectqsgsupport_p.h"
+#include <QtLocation/private/qgeomap_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+static int findMapObject(QGeoMapObject *o, const QList<MapObject> &list)
+{
+ for (int i = 0; i < list.size(); ++i)
+ {
+ if (list.at(i).object.data() == o)
+ return i;
+ }
+ return -1;
+}
+
+bool QGeoMapObjectQSGSupport::createMapObjectImplementation(QGeoMapObject *obj, QGeoMapPrivate *d)
+{
+ QExplicitlySharedDataPointer<QGeoMapObjectPrivate> pimpl =
+ QExplicitlySharedDataPointer<QGeoMapObjectPrivate>(d->createMapObjectImplementation(obj));
+ if (pimpl.constData()) {
+ bool res = obj->setImplementation(pimpl);
+ if (res)
+ emit m_map->sgNodeChanged();
+ return res;
+ }
+ return false;
+}
+
+QGeoMapObjectPrivate *QGeoMapObjectQSGSupport::createMapObjectImplementationPrivate(QGeoMapObject *obj)
+{
+ QGeoMapObjectPrivate *res = nullptr;
+
+ {
+ QQSGMapObject *sgo = nullptr;
+ switch (obj->type()) {
+ case QGeoMapObject::PolylineType: {
+ QMapPolylineObjectPrivate &oldImpl = static_cast<QMapPolylineObjectPrivate &>(*obj->implementation());
+ QMapPolylineObjectPrivateQSG *pimpl =
+ new QMapPolylineObjectPrivateQSG(oldImpl);
+ sgo = pimpl;
+ res = pimpl;
+ break;
+ }
+ case QGeoMapObject::PolygonType: {
+ QMapPolygonObjectPrivate &oldImpl = static_cast<QMapPolygonObjectPrivate &>(*obj->implementation());
+ QMapPolygonObjectPrivateQSG *pimpl =
+ new QMapPolygonObjectPrivateQSG(oldImpl);
+ sgo = pimpl;
+ res = pimpl;
+ break;
+ }
+ case QGeoMapObject::CircleType: {
+ QMapCircleObjectPrivate &oldImpl = static_cast<QMapCircleObjectPrivate &>(*obj->implementation());
+ QMapCircleObjectPrivateQSG *pimpl =
+ new QMapCircleObjectPrivateQSG(oldImpl);
+ sgo = pimpl;
+ res = pimpl;
+ break;
+ }
+ case QGeoMapObject::RouteType: {
+ QMapRouteObjectPrivate &oldImpl = static_cast<QMapRouteObjectPrivate &>(*obj->implementation());
+ QMapRouteObjectPrivateQSG *pimpl =
+ new QMapRouteObjectPrivateQSG(oldImpl);
+ sgo = pimpl;
+ res = pimpl;
+ break;
+ }
+ case QGeoMapObject::IconType: {
+ QMapIconObjectPrivate &oldImpl = static_cast<QMapIconObjectPrivate &>(*obj->implementation());
+ QMapIconObjectPrivateQSG *pimpl =
+ new QMapIconObjectPrivateQSG(oldImpl);
+ sgo = pimpl;
+ res = pimpl;
+ break;
+ }
+ default:
+ // Use the following warning only for debugging purposes.
+ // qWarning() << "QGeoMapObjectQSGSupport::createMapObjectImplementationPrivate: not instantiating pimpl for unsupported object type " << obj->type();
+ break;
+ }
+
+ if (res) {
+ QPointer<QGeoMapObject> p(obj);
+ MapObject mo(p, sgo);
+ m_pendingMapObjects << mo;
+ }
+ }
+ return res;
+}
+
+QList<QGeoMapObject *> QGeoMapObjectQSGSupport::mapObjects() const
+{
+ return QList<QGeoMapObject *>();
+}
+
+void QGeoMapObjectQSGSupport::removeMapObject(QGeoMapObject *obj)
+{
+ int idx = findMapObject(obj, m_mapObjects);
+ if (idx >= 0) {
+ const MapObject &mo = m_mapObjects.takeAt(idx);
+ obj->disconnect(m_map);
+ m_removedMapObjects << mo;
+ emit m_map->sgNodeChanged();
+ } else {
+ idx = findMapObject(obj, m_pendingMapObjects);
+ if (idx >= 0) {
+ m_pendingMapObjects.removeAt(idx);
+ obj->disconnect(m_map);
+ } else {
+ // obj not here.
+ }
+ }
+}
+
+void QGeoMapObjectQSGSupport::updateMapObjects(QSGNode *root, QQuickWindow *window)
+{
+ for (int i = 0; i < m_removedMapObjects.size(); ++i) {
+ MapObject mo = m_removedMapObjects[i];
+ if (mo.qsgNode) {
+ root->removeChildNode(mo.qsgNode);
+ delete mo.qsgNode;
+ mo.qsgNode = nullptr;
+ // mo.sgObject is now invalid as it is destroyed right after appending
+ // mo to m_removedMapObjects
+ }
+ }
+ m_removedMapObjects.clear();
+
+ for (int i = 0; i < m_mapObjects.size(); ++i) {
+ // already added as node
+ if (Q_UNLIKELY(!m_mapObjects.at(i).object)) {
+ qWarning() << "unexpected NULL pointer in m_mapObjects at "<<i;
+ continue;
+ }
+
+ MapObject &mo = m_mapObjects[i];
+ QQSGMapObject *sgo = mo.sgObject;
+ QSGNode *oldNode = mo.qsgNode;
+ mo.qsgNode = sgo->updateMapObjectNode(oldNode, &mo.visibleNode, root, window);
+ if (Q_UNLIKELY(!mo.qsgNode)) {
+ qWarning() << "updateMapObjectNode for "<<mo.object->type() << " returned NULL";
+ } else if (mo.visibleNode && (mo.visibleNode->visible() != mo.object->visible())) {
+ mo.visibleNode->setVisible(mo.object->visible());
+ mo.qsgNode->markDirty(QSGNode::DirtySubtreeBlocked);
+ }
+ }
+
+ QList<int> toRemove;
+ for (int i = 0; i < m_pendingMapObjects.size(); ++i) {
+ // already added as node
+ MapObject &mo = m_pendingMapObjects[i];
+ QQSGMapObject *sgo = mo.sgObject;
+ QSGNode *oldNode = mo.qsgNode;
+ sgo->updateGeometry(); // or subtree will be blocked
+ mo.qsgNode = sgo->updateMapObjectNode(oldNode, &mo.visibleNode, root, window);
+ if (mo.qsgNode) {
+ if (mo.visibleNode && (mo.visibleNode->visible() != mo.object->visible())) {
+ mo.visibleNode->setVisible(mo.object->visible());
+ mo.qsgNode->markDirty(QSGNode::DirtySubtreeBlocked);
+ }
+ m_mapObjects << mo;
+ toRemove.push_front(i);
+ QObject::connect(mo.object, SIGNAL(visibleChanged()), m_map, SIGNAL(sgNodeChanged()));
+ } else {
+ // leave it to be processed, don't spit warnings
+ }
+ }
+
+ for (int i: qAsConst(toRemove))
+ m_pendingMapObjects.removeAt(i);
+}
+
+void QGeoMapObjectQSGSupport::updateObjectsGeometry()
+{
+ for (int i = 0; i < m_mapObjects.size(); ++i) {
+ // already added as node
+ if (Q_UNLIKELY(!m_mapObjects.at(i).object)) {
+ qWarning() << "unexpected NULL pointer in m_mapObjects at "<<i;
+ continue;
+ }
+
+ QQSGMapObject *sgo = m_mapObjects.at(i).sgObject;
+ sgo->updateGeometry();
+ }
+ emit m_map->sgNodeChanged();
+}
+
+QT_END_NAMESPACE
diff --git a/src/location/labs/qsg/qgeomapobjectqsgsupport_p.h b/src/location/labs/qsg/qgeomapobjectqsgsupport_p.h
new file mode 100644
index 00000000..bb0477c5
--- /dev/null
+++ b/src/location/labs/qsg/qgeomapobjectqsgsupport_p.h
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGEOMAPOBJECTQSGSUPPORT_P_H
+#define QGEOMAPOBJECTQSGSUPPORT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtLocation/private/qlocationglobal_p.h>
+#include <QtLocation/private/qgeomapobject_p.h>
+#include <QtLocation/private/qgeomapobject_p_p.h>
+#include <QtLocation/private/qmappolylineobjectqsg_p_p.h>
+#include <QtLocation/private/qmappolygonobjectqsg_p_p.h>
+#include <QtLocation/private/qmapcircleobjectqsg_p_p.h>
+#include <QtLocation/private/qmaprouteobjectqsg_p_p.h>
+#include <QtLocation/private/qmapiconobjectqsg_p_p.h>
+#include <QtLocation/private/qdeclarativepolylinemapitem_p.h>
+#include <QtCore/qpointer.h>
+
+QT_BEGIN_NAMESPACE
+
+struct Q_LOCATION_PRIVATE_EXPORT MapObject {
+ MapObject(QPointer<QGeoMapObject> &o, QQSGMapObject *sgo)
+ : object(o), sgObject(sgo) {}
+
+ QPointer<QGeoMapObject> object;
+ QQSGMapObject *sgObject = nullptr; // this is a QMap*ObjectPrivateQSG. it becomes invalid when the pimpl is destroyed
+ VisibleNode *visibleNode = nullptr; // This is a Map*Node (like a MapPolygonNode) that is a QSGNode. This doesn't disappear by itself
+ QSGNode *qsgNode = nullptr;
+};
+
+class Q_LOCATION_PRIVATE_EXPORT QGeoMapObjectQSGSupport
+{
+public:
+ bool createMapObjectImplementation(QGeoMapObject *obj, QGeoMapPrivate *d);
+ QGeoMapObjectPrivate *createMapObjectImplementationPrivate(QGeoMapObject *obj);
+ QList<QGeoMapObject *> mapObjects() const;
+ void removeMapObject(QGeoMapObject *obj);
+ void updateMapObjects(QSGNode *root, QQuickWindow *window);
+ void updateObjectsGeometry();
+
+ QList<MapObject> m_mapObjects;
+ QList<MapObject> m_pendingMapObjects;
+ QList<MapObject> m_removedMapObjects;
+ QGeoMap *m_map = nullptr;
+};
+
+QT_END_NAMESPACE
+
+#endif // QGEOMAPOBJECTQSGSUPPORT_P_H
diff --git a/src/location/labs/qsg/qmapcircleobjectqsg.cpp b/src/location/labs/qsg/qmapcircleobjectqsg.cpp
index 9fe3ee0a..775016b9 100644
--- a/src/location/labs/qsg/qmapcircleobjectqsg.cpp
+++ b/src/location/labs/qsg/qmapcircleobjectqsg.cpp
@@ -60,7 +60,8 @@ QMapCircleObjectPrivateQSG::QMapCircleObjectPrivateQSG(const QMapCircleObjectPri
QMapCircleObjectPrivateQSG::~QMapCircleObjectPrivateQSG()
{
-
+ if (m_map)
+ m_map->removeMapObject(q);
}
void QMapCircleObjectPrivateQSG::updateCirclePath()
@@ -147,13 +148,18 @@ QGeoMapObjectPrivate *QMapCircleObjectPrivateQSG::clone()
return new QMapCircleObjectPrivateQSG(static_cast<QMapCircleObjectPrivate &>(*this));
}
-QSGNode *QMapCircleObjectPrivateQSG::updateMapObjectNode(QSGNode *oldNode, QSGNode *root, QQuickWindow * /*window*/)
+QSGNode *QMapCircleObjectPrivateQSG::updateMapObjectNode(QSGNode *oldNode,
+ VisibleNode **visibleNode,
+ QSGNode *root,
+ QQuickWindow * /*window*/)
{
+// Q_UNUSED(visibleNode) // coz of -Werror=unused-but-set-parameter
MapPolygonNode *node = static_cast<MapPolygonNode *>(oldNode);
bool created = false;
if (!node) {
node = new MapPolygonNode();
+ *visibleNode = static_cast<VisibleNode *>(node);
created = true;
}
diff --git a/src/location/labs/qsg/qmapcircleobjectqsg_p_p.h b/src/location/labs/qsg/qmapcircleobjectqsg_p_p.h
index 17d8568a..4e8162fa 100644
--- a/src/location/labs/qsg/qmapcircleobjectqsg_p_p.h
+++ b/src/location/labs/qsg/qmapcircleobjectqsg_p_p.h
@@ -72,7 +72,10 @@ public:
// QQSGMapObject
void updateGeometry() override;
- QSGNode *updateMapObjectNode(QSGNode *oldNode, QSGNode *root, QQuickWindow *window) override;
+ QSGNode *updateMapObjectNode(QSGNode *oldNode,
+ VisibleNode **visibleNode,
+ QSGNode *root,
+ QQuickWindow *window) override;
// QGeoMapCirclePrivate interface
void setCenter(const QGeoCoordinate &center) override;
diff --git a/src/location/labs/qsg/qmapiconobjectqsg.cpp b/src/location/labs/qsg/qmapiconobjectqsg.cpp
index 53d16179..47c39695 100644
--- a/src/location/labs/qsg/qmapiconobjectqsg.cpp
+++ b/src/location/labs/qsg/qmapiconobjectqsg.cpp
@@ -43,26 +43,19 @@
#include <QtQml/qqmlengine.h>
#include <QtQml/qqml.h>
#include <QtNetwork/qnetworkaccessmanager.h>
+#include <QtLocation/private/qdeclarativepolylinemapitem_p.h>
QT_BEGIN_NAMESPACE
-class RootNode : public QSGTransformNode
+class RootNode : public QSGTransformNode, public VisibleNode
{
public:
- RootNode() : QSGTransformNode()
- { }
+ RootNode() { }
bool isSubtreeBlocked() const override
{
- return m_blocked;
+ return subtreeBlocked();
}
-
- void setSubtreeBlocked(bool blocked)
- {
- m_blocked = blocked;
- }
-
- bool m_blocked = false;
};
QMapIconObjectPrivateQSG::QMapIconObjectPrivateQSG(QGeoMapObject *q)
@@ -80,7 +73,8 @@ QMapIconObjectPrivateQSG::QMapIconObjectPrivateQSG(const QMapIconObjectPrivate &
QMapIconObjectPrivateQSG::~QMapIconObjectPrivateQSG()
{
-
+ if (m_map)
+ m_map->removeMapObject(q);
}
void QMapIconObjectPrivateQSG::updateGeometry()
@@ -100,8 +94,12 @@ void QMapIconObjectPrivateQSG::updateGeometry()
// TODO: support and test for zoomLevel
}
-QSGNode *QMapIconObjectPrivateQSG::updateMapObjectNode(QSGNode *oldNode, QSGNode * root, QQuickWindow *window)
+QSGNode *QMapIconObjectPrivateQSG::updateMapObjectNode(QSGNode *oldNode,
+ VisibleNode **visibleNode,
+ QSGNode *root,
+ QQuickWindow *window)
{
+ Q_UNUSED(visibleNode)
bool created = false;
RootNode *node = static_cast<RootNode *>(oldNode);
if (!node) {
@@ -109,6 +107,7 @@ QSGNode *QMapIconObjectPrivateQSG::updateMapObjectNode(QSGNode *oldNode, QSGNode
m_imageNode = window->createImageNode();
m_imageNode->setOwnsTexture(true);
node->appendChildNode(m_imageNode);
+ *visibleNode = static_cast<VisibleNode *>(node);
created = true;
}
diff --git a/src/location/labs/qsg/qmapiconobjectqsg_p_p.h b/src/location/labs/qsg/qmapiconobjectqsg_p_p.h
index a2f7cf40..c57828af 100644
--- a/src/location/labs/qsg/qmapiconobjectqsg_p_p.h
+++ b/src/location/labs/qsg/qmapiconobjectqsg_p_p.h
@@ -69,7 +69,10 @@ public:
// QQSGMapObject
void updateGeometry() override;
- QSGNode *updateMapObjectNode(QSGNode *oldNode, QSGNode *root, QQuickWindow *window) override;
+ QSGNode *updateMapObjectNode(QSGNode *oldNode,
+ VisibleNode **visibleNode,
+ QSGNode *root,
+ QQuickWindow *window) override;
// QGeoMapIconPrivate interface
void setCoordinate(const QGeoCoordinate &coordinate) override;
diff --git a/src/location/labs/qsg/qmappolygonobjectqsg.cpp b/src/location/labs/qsg/qmappolygonobjectqsg.cpp
index 27dcc80f..b9602a3a 100644
--- a/src/location/labs/qsg/qmappolygonobjectqsg.cpp
+++ b/src/location/labs/qsg/qmappolygonobjectqsg.cpp
@@ -57,7 +57,8 @@ QMapPolygonObjectPrivateQSG::QMapPolygonObjectPrivateQSG(const QMapPolygonObject
QMapPolygonObjectPrivateQSG::~QMapPolygonObjectPrivateQSG()
{
-
+ if (m_map)
+ m_map->removeMapObject(q);
}
QList<QDoubleVector2D> QMapPolygonObjectPrivateQSG::projectPath()
@@ -74,13 +75,18 @@ QList<QDoubleVector2D> QMapPolygonObjectPrivateQSG::projectPath()
return geopathProjected_;
}
-QSGNode *QMapPolygonObjectPrivateQSG::updateMapObjectNode(QSGNode *oldNode, QSGNode *root, QQuickWindow * /*window*/)
+QSGNode *QMapPolygonObjectPrivateQSG::updateMapObjectNode(QSGNode *oldNode,
+ VisibleNode **visibleNode,
+ QSGNode *root,
+ QQuickWindow */*window*/)
{
+ Q_UNUSED(visibleNode)
MapPolygonNode *node = static_cast<MapPolygonNode *>(oldNode);
bool created = false;
if (!node) {
node = new MapPolygonNode();
+ *visibleNode = static_cast<VisibleNode *>(node);
created = true;
}
diff --git a/src/location/labs/qsg/qmappolygonobjectqsg_p_p.h b/src/location/labs/qsg/qmappolygonobjectqsg_p_p.h
index bd5efcff..b288528a 100644
--- a/src/location/labs/qsg/qmappolygonobjectqsg_p_p.h
+++ b/src/location/labs/qsg/qmappolygonobjectqsg_p_p.h
@@ -68,7 +68,10 @@ public:
// QQSGMapObject
void updateGeometry() override;
- QSGNode *updateMapObjectNode(QSGNode *oldNode, QSGNode *root, QQuickWindow *window) override;
+ QSGNode *updateMapObjectNode(QSGNode *oldNode,
+ VisibleNode **visibleNode,
+ QSGNode *root,
+ QQuickWindow *window) override;
// QGeoMapPolylinePrivate interface
QList<QGeoCoordinate> path() const override;
diff --git a/src/location/labs/qsg/qmappolylineobjectqsg.cpp b/src/location/labs/qsg/qmappolylineobjectqsg.cpp
index c0c3854e..6b782c77 100644
--- a/src/location/labs/qsg/qmappolylineobjectqsg.cpp
+++ b/src/location/labs/qsg/qmappolylineobjectqsg.cpp
@@ -61,7 +61,8 @@ QMapPolylineObjectPrivateQSG::QMapPolylineObjectPrivateQSG(const QMapPolylineObj
QMapPolylineObjectPrivateQSG::~QMapPolylineObjectPrivateQSG()
{
-
+ if (m_map)
+ m_map->removeMapObject(q);
}
QList<QDoubleVector2D> QMapPolylineObjectPrivateQSG::projectPath()
@@ -96,13 +97,18 @@ void QMapPolylineObjectPrivateQSG::updateGeometry()
m_geometry.translate(origin - m_geometry.firstPointOffset());
}
-QSGNode *QMapPolylineObjectPrivateQSG::updateMapObjectNode(QSGNode *oldNode, QSGNode *root, QQuickWindow * /*window*/)
+QSGNode *QMapPolylineObjectPrivateQSG::updateMapObjectNode(QSGNode *oldNode,
+ VisibleNode **visibleNode,
+ QSGNode *root,
+ QQuickWindow */*window*/)
{
+ Q_UNUSED(visibleNode)
MapPolylineNode *node = static_cast<MapPolylineNode *>(oldNode);
bool created = false;
if (!node) {
node = new MapPolylineNode();
+ *visibleNode = static_cast<VisibleNode *>(node);
created = true;
}
diff --git a/src/location/labs/qsg/qmappolylineobjectqsg_p_p.h b/src/location/labs/qsg/qmappolylineobjectqsg_p_p.h
index 52b5e89a..792413e5 100644
--- a/src/location/labs/qsg/qmappolylineobjectqsg_p_p.h
+++ b/src/location/labs/qsg/qmappolylineobjectqsg_p_p.h
@@ -68,7 +68,10 @@ public:
// QQSGMapObject
void updateGeometry() override;
- QSGNode *updateMapObjectNode(QSGNode *oldNode, QSGNode *root, QQuickWindow *window) override;
+ QSGNode *updateMapObjectNode(QSGNode *oldNode,
+ VisibleNode **visibleNode,
+ QSGNode *root,
+ QQuickWindow *window) override;
// QGeoMapPolylinePrivate interface
QList<QGeoCoordinate> path() const override;
diff --git a/src/location/labs/qsg/qmaprouteobjectqsg.cpp b/src/location/labs/qsg/qmaprouteobjectqsg.cpp
index a8728e08..eaea64f3 100644
--- a/src/location/labs/qsg/qmaprouteobjectqsg.cpp
+++ b/src/location/labs/qsg/qmaprouteobjectqsg.cpp
@@ -57,7 +57,8 @@ QMapRouteObjectPrivateQSG::QMapRouteObjectPrivateQSG(const QMapRouteObjectPrivat
QMapRouteObjectPrivateQSG::~QMapRouteObjectPrivateQSG()
{
-
+ if (m_map)
+ m_map->removeMapObject(q);
}
void QMapRouteObjectPrivateQSG::updateGeometry()
@@ -65,9 +66,12 @@ void QMapRouteObjectPrivateQSG::updateGeometry()
m_polyline->updateGeometry();
}
-QSGNode *QMapRouteObjectPrivateQSG::updateMapObjectNode(QSGNode *oldNode, QSGNode *root, QQuickWindow * window)
+QSGNode *QMapRouteObjectPrivateQSG::updateMapObjectNode(QSGNode *oldNode,
+ VisibleNode **visibleNode,
+ QSGNode *root,
+ QQuickWindow *window)
{
- return m_polyline->updateMapObjectNode(oldNode, root, window);
+ return m_polyline->updateMapObjectNode(oldNode, visibleNode, root, window);
}
void QMapRouteObjectPrivateQSG::setRoute(const QDeclarativeGeoRoute *route)
diff --git a/src/location/labs/qsg/qmaprouteobjectqsg_p_p.h b/src/location/labs/qsg/qmaprouteobjectqsg_p_p.h
index 1c612532..0c946259 100644
--- a/src/location/labs/qsg/qmaprouteobjectqsg_p_p.h
+++ b/src/location/labs/qsg/qmaprouteobjectqsg_p_p.h
@@ -68,7 +68,10 @@ public:
// QQSGMapObject
void updateGeometry() override;
- QSGNode *updateMapObjectNode(QSGNode *oldNode, QSGNode *root, QQuickWindow *window) override;
+ QSGNode *updateMapObjectNode(QSGNode *oldNode,
+ VisibleNode **visibleNode,
+ QSGNode *root,
+ QQuickWindow *window) override;
// QMapRouteObjectPrivate interface
void setRoute(const QDeclarativeGeoRoute *route) override;
diff --git a/src/location/labs/qsg/qqsgmapobject.cpp b/src/location/labs/qsg/qqsgmapobject.cpp
index 5b4f7dbf..ccda12d8 100644
--- a/src/location/labs/qsg/qqsgmapobject.cpp
+++ b/src/location/labs/qsg/qqsgmapobject.cpp
@@ -35,6 +35,7 @@
****************************************************************************/
#include "qqsgmapobject_p.h"
+#include <QDebug>
QT_BEGIN_NAMESPACE
@@ -48,7 +49,10 @@ QQSGMapObject::~QQSGMapObject()
}
-QSGNode *QQSGMapObject::updateMapObjectNode(QSGNode *oldNode, QSGNode * /*root*/, QQuickWindow * /*window*/)
+QSGNode *QQSGMapObject::updateMapObjectNode(QSGNode *oldNode,
+ VisibleNode **/*visibleNode*/,
+ QSGNode * /*root*/,
+ QQuickWindow * /*window*/)
{
delete oldNode;
return 0;
diff --git a/src/location/labs/qsg/qqsgmapobject_p.h b/src/location/labs/qsg/qqsgmapobject_p.h
index d3e54a68..1aecc990 100644
--- a/src/location/labs/qsg/qqsgmapobject_p.h
+++ b/src/location/labs/qsg/qqsgmapobject_p.h
@@ -40,6 +40,7 @@
#include <QtLocation/private/qlocationglobal_p.h>
#include <QtQuick/QSGOpacityNode>
#include <QtLocation/private/qgeomapobject_p.h>
+#include <QtLocation/private/qdeclarativepolylinemapitem_p.h>
QT_BEGIN_NAMESPACE
@@ -50,10 +51,11 @@ public:
QQSGMapObject();
virtual ~QQSGMapObject();
- virtual QSGNode *updateMapObjectNode(QSGNode *oldNode, QSGNode *root, QQuickWindow *window);
+ virtual QSGNode *updateMapObjectNode(QSGNode *oldNode,
+ VisibleNode **visibleNode,
+ QSGNode *root,
+ QQuickWindow *window);
virtual void updateGeometry();
-
- QSGNode *node = nullptr;
};
QT_END_NAMESPACE
diff --git a/src/location/maps/qgeomap_p.h b/src/location/maps/qgeomap_p.h
index e67340be..f6be5cae 100644
--- a/src/location/maps/qgeomap_p.h
+++ b/src/location/maps/qgeomap_p.h
@@ -151,13 +151,13 @@ public:
virtual bool fitViewportToGeoRectangle(const QGeoRectangle &rectangle);
virtual void setCopyrightVisible(bool visible);
+ virtual void removeMapObject(QGeoMapObject *obj);
protected:
QGeoMap(QGeoMapPrivate &dd, QObject *parent = 0);
void setCameraData(const QGeoCameraData &cameraData);
void setCameraCapabilities(const QGeoCameraCapabilities &cameraCapabilities);
virtual QSGNode *updateSceneGraph(QSGNode *node, QQuickWindow *window) = 0;
- virtual void removeMapObject(QGeoMapObject *obj);
Q_SIGNALS:
void cameraDataChanged(const QGeoCameraData &cameraData);
diff --git a/src/location/maps/qgeomap_p_p.h b/src/location/maps/qgeomap_p_p.h
index 18c72202..47780c47 100644
--- a/src/location/maps/qgeomap_p_p.h
+++ b/src/location/maps/qgeomap_p_p.h
@@ -80,6 +80,7 @@ public:
const QGeoCameraCapabilities &cameraCapabilities() const;
static const QGeoMapPrivate *get(const QGeoMap &map);
+ virtual QGeoMapObjectPrivate *createMapObjectImplementation(QGeoMapObject *obj);
protected:
/* Hooks into the actual map implementations */
@@ -90,7 +91,6 @@ protected:
virtual void addMapItem(QDeclarativeGeoMapItemBase *item);
virtual void removeMapItem(QDeclarativeGeoMapItemBase *item);
- virtual QGeoMapObjectPrivate *createMapObjectImplementation(QGeoMapObject *obj);
virtual QList<QGeoMapObject *> mapObjects() const;
virtual void changeViewportSize(const QSize &size) = 0; // called by QGeoMap::setSize()
diff --git a/src/location/maps/qgeoserviceprovider.cpp b/src/location/maps/qgeoserviceprovider.cpp
index 3cb0f2df..2d8151ad 100644
--- a/src/location/maps/qgeoserviceprovider.cpp
+++ b/src/location/maps/qgeoserviceprovider.cpp
@@ -742,8 +742,11 @@ void QGeoServiceProviderPrivate::loadPlugin(const QVariantMap &parameters)
// load the actual plugin
QObject *instance = loader()->instance(idx);
- factory = qobject_cast<QGeoServiceProviderFactory *>(instance);
factoryV2 = qobject_cast<QGeoServiceProviderFactoryV2 *>(instance);
+ if (!factoryV2)
+ factory = qobject_cast<QGeoServiceProviderFactory *>(instance);
+ else
+ factory = factoryV2;
}
QHash<QString, QJsonObject> QGeoServiceProviderPrivate::plugins(bool reload)
diff --git a/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.cpp b/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.cpp
index 99146801..af0e263b 100644
--- a/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.cpp
+++ b/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.cpp
@@ -47,12 +47,8 @@
#include <QtLocation/private/qmapcircleobjectqsg_p_p.h>
#include <QtLocation/private/qmaprouteobjectqsg_p_p.h>
#include <QtLocation/private/qmapiconobjectqsg_p_p.h>
-struct MapObject {
- MapObject(QPointer<QGeoMapObject> &o, QQSGMapObject *sgo)
- : object(o), sgObject(sgo) {}
- QPointer<QGeoMapObject> object;
- QQSGMapObject *sgObject = nullptr;
-};
+#include <QtLocation/private/qdeclarativepolylinemapitem_p.h>
+#include <QtLocation/private/qgeomapobjectqsgsupport_p.h>
#endif
QT_BEGIN_NAMESPACE
@@ -61,18 +57,16 @@ class QGeoMapItemsOverlayPrivate : public QGeoMapPrivate
{
Q_DECLARE_PUBLIC(QGeoMapItemsOverlay)
public:
- QGeoMapItemsOverlayPrivate(QGeoMappingManagerEngineItemsOverlay *engine);
+ QGeoMapItemsOverlayPrivate(QGeoMappingManagerEngineItemsOverlay *engine, QGeoMapItemsOverlay *map);
virtual ~QGeoMapItemsOverlayPrivate();
#ifdef LOCATIONLABS
QGeoMapObjectPrivate *createMapObjectImplementation(QGeoMapObject *obj) override;
virtual QList<QGeoMapObject *> mapObjects() const override;
- static int findMapObject(QGeoMapObject *o, const QList<MapObject> &list);
void removeMapObject(QGeoMapObject *obj);
void updateMapObjects(QSGNode *root, QQuickWindow *window);
- QList<MapObject> m_mapObjects;
- QList<MapObject> m_pendingMapObjects;
+ QGeoMapObjectQSGSupport m_qsgSupport;
#endif
void updateObjectsGeometry();
@@ -83,7 +77,7 @@ protected:
};
QGeoMapItemsOverlay::QGeoMapItemsOverlay(QGeoMappingManagerEngineItemsOverlay *engine, QObject *parent)
- : QGeoMap(*(new QGeoMapItemsOverlayPrivate(engine)), parent)
+ : QGeoMap(*(new QGeoMapItemsOverlayPrivate(engine, this)), parent)
{
}
@@ -99,6 +93,16 @@ QGeoMap::Capabilities QGeoMapItemsOverlay::capabilities() const
| SupportsAnchoringCoordinate);
}
+bool QGeoMapItemsOverlay::createMapObjectImplementation(QGeoMapObject *obj)
+{
+#ifndef LOCATIONLABS
+ return false;
+#else
+ Q_D(QGeoMapItemsOverlay);
+ return d->m_qsgSupport.createMapObjectImplementation(obj, d);
+#endif
+}
+
QSGNode *QGeoMapItemsOverlay::updateSceneGraph(QSGNode *node, QQuickWindow *window)
{
#ifndef LOCATIONLABS
@@ -119,9 +123,18 @@ QSGNode *QGeoMapItemsOverlay::updateSceneGraph(QSGNode *node, QQuickWindow *wind
#endif
}
-QGeoMapItemsOverlayPrivate::QGeoMapItemsOverlayPrivate(QGeoMappingManagerEngineItemsOverlay *engine)
+void QGeoMapItemsOverlay::removeMapObject(QGeoMapObject *obj)
+{
+#ifdef LOCATIONLABS
+ Q_D(QGeoMapItemsOverlay);
+ d->removeMapObject(obj);
+#endif
+}
+
+QGeoMapItemsOverlayPrivate::QGeoMapItemsOverlayPrivate(QGeoMappingManagerEngineItemsOverlay *engine, QGeoMapItemsOverlay *map)
: QGeoMapPrivate(engine, new QGeoProjectionWebMercator)
{
+ m_qsgSupport.m_map = map;
}
QGeoMapItemsOverlayPrivate::~QGeoMapItemsOverlayPrivate()
@@ -131,138 +144,29 @@ QGeoMapItemsOverlayPrivate::~QGeoMapItemsOverlayPrivate()
#ifdef LOCATIONLABS
QGeoMapObjectPrivate *QGeoMapItemsOverlayPrivate::createMapObjectImplementation(QGeoMapObject *obj)
{
- switch (obj->type()) {
- case QGeoMapObject::PolylineType: {
- QMapPolylineObjectPrivate &oldImpl = static_cast<QMapPolylineObjectPrivate &>(*obj->implementation());
- QMapPolylineObjectPrivateQSG *pimpl =
- new QMapPolylineObjectPrivateQSG(oldImpl);
- QPointer<QGeoMapObject> p(obj);
- MapObject mo(p, pimpl);
- m_pendingMapObjects << mo;
- return pimpl;
- }
- case QGeoMapObject::PolygonType: {
- QMapPolygonObjectPrivate &oldImpl = static_cast<QMapPolygonObjectPrivate &>(*obj->implementation());
- QMapPolygonObjectPrivateQSG *pimpl =
- new QMapPolygonObjectPrivateQSG(oldImpl);
- QPointer<QGeoMapObject> p(obj);
- MapObject mo(p, pimpl);
- m_pendingMapObjects << mo;
- return pimpl;
- }
- case QGeoMapObject::CircleType: {
- QMapCircleObjectPrivate &oldImpl = static_cast<QMapCircleObjectPrivate &>(*obj->implementation());
- QMapCircleObjectPrivateQSG *pimpl =
- new QMapCircleObjectPrivateQSG(oldImpl);
- QPointer<QGeoMapObject> p(obj);
- MapObject mo(p, pimpl);
- m_pendingMapObjects << mo;
- return pimpl;
- }
- case QGeoMapObject::RouteType: {
- QMapRouteObjectPrivate &oldImpl = static_cast<QMapRouteObjectPrivate &>(*obj->implementation());
- QMapRouteObjectPrivateQSG *pimpl =
- new QMapRouteObjectPrivateQSG(oldImpl);
- QPointer<QGeoMapObject> p(obj);
- MapObject mo(p, pimpl);
- m_pendingMapObjects << mo;
- return pimpl;
- }
- case QGeoMapObject::IconType: {
- QMapIconObjectPrivate &oldImpl = static_cast<QMapIconObjectPrivate &>(*obj->implementation());
- QMapIconObjectPrivateQSG *pimpl =
- new QMapIconObjectPrivateQSG(oldImpl);
- QPointer<QGeoMapObject> p(obj);
- MapObject mo(p, pimpl);
- m_pendingMapObjects << mo;
- return pimpl;
- }
- default:
- qWarning() << "Unsupported object type: " << obj->type();
- break;
- }
- return nullptr;
+ return m_qsgSupport.createMapObjectImplementationPrivate(obj);
}
QList<QGeoMapObject *> QGeoMapItemsOverlayPrivate::mapObjects() const
{
- return QList<QGeoMapObject *>();
-}
-
-int QGeoMapItemsOverlayPrivate::findMapObject(QGeoMapObject *o, const QList<MapObject> &list)
-{
- for (int i = 0; i < list.size(); ++i)
- {
- if (list.at(i).object.data() == o)
- return i;
- }
- return -1;
+ return m_qsgSupport.mapObjects();
}
void QGeoMapItemsOverlayPrivate::removeMapObject(QGeoMapObject *obj)
{
- int idx = findMapObject(obj, m_mapObjects);
- if (idx >= 0) {
- m_mapObjects.removeAt(idx);
- } else {
- idx = findMapObject(obj, m_pendingMapObjects);
- if (idx >= 0) {
- m_pendingMapObjects.removeAt(idx);
- } else {
- // obj not here.
- }
- }
+ m_qsgSupport.removeMapObject(obj);
}
void QGeoMapItemsOverlayPrivate::updateMapObjects(QSGNode *root, QQuickWindow *window)
{
- for (int i = 0; i < m_mapObjects.size(); ++i) {
- // already added as node
- if (!m_mapObjects.at(i).object) {
- qWarning() << "m_mapObjects at "<<i<< " NULLed!!";
- continue;
- }
-
- QQSGMapObject *sgo = m_mapObjects.at(i).sgObject;
- QSGNode *oldNode = sgo->node;
- sgo->node = sgo->updateMapObjectNode(oldNode, root, window);
- }
-
- QList<int> toRemove;
- for (int i = 0; i < m_pendingMapObjects.size(); ++i) {
- // already added as node
- QQSGMapObject *sgo = m_pendingMapObjects.at(i).sgObject;
- QSGNode *oldNode = sgo->node;
- sgo->updateGeometry(); // or subtree will be blocked
- sgo->node = sgo->updateMapObjectNode(oldNode, root, window);
- if (sgo->node) {
- m_mapObjects << m_pendingMapObjects.at(i);
- toRemove.push_front(i);
- } else {
- // leave it to be processed
- }
- }
-
- for (int i: qAsConst(toRemove))
- m_pendingMapObjects.removeAt(i);
+ m_qsgSupport.updateMapObjects(root, window);
}
#endif
void QGeoMapItemsOverlayPrivate::updateObjectsGeometry()
{
#ifdef LOCATIONLABS
- Q_Q(QGeoMapItemsOverlay);
- for (int i = 0; i < m_mapObjects.size(); ++i) {
- // already added as node
- if (!m_mapObjects.at(i).object) {
- qWarning() << "m_mapObjects at "<<i<< " NULLed!!";
- continue;
- }
-
- QQSGMapObject *sgo = m_mapObjects.at(i).sgObject;
- sgo->updateGeometry();
- }
- emit q->sgNodeChanged();
+ m_qsgSupport.updateObjectsGeometry();
#endif
}
diff --git a/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.h b/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.h
index 42a59f06..1594ffb3 100644
--- a/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.h
+++ b/src/plugins/geoservices/itemsoverlay/qgeomapitemsoverlay.h
@@ -54,6 +54,8 @@ public:
virtual ~QGeoMapItemsOverlay();
QGeoMap::Capabilities capabilities() const override;
+ bool createMapObjectImplementation(QGeoMapObject *obj) override;
+ void removeMapObject(QGeoMapObject *obj) override;
protected:
QSGNode *updateSceneGraph(QSGNode *node, QQuickWindow *window) override;
diff --git a/src/positioning/doc/snippets/doc_src_qtpositioning.qml b/src/positioning/doc/snippets/doc_src_qtpositioning.qml
index 73b2fd56..ee6e8328 100644
--- a/src/positioning/doc/snippets/doc_src_qtpositioning.qml
+++ b/src/positioning/doc/snippets/doc_src_qtpositioning.qml
@@ -49,7 +49,7 @@
****************************************************************************/
//! [import]
-import QtPositioning 5.2
+import QtPositioning 5.11
//! [import]
Item {
diff --git a/src/positioning/doc/src/qtpositioning-qml.qdoc b/src/positioning/doc/src/qtpositioning-qml.qdoc
index e839dc48..7c9567cb 100644
--- a/src/positioning/doc/src/qtpositioning-qml.qdoc
+++ b/src/positioning/doc/src/qtpositioning-qml.qdoc
@@ -26,7 +26,7 @@
****************************************************************************/
/*!
- \qmlmodule QtPositioning 5.2
+ \qmlmodule QtPositioning 5.11
\title Qt Positioning QML Types
\ingroup qmlmodules
\brief Provides QML types for position information