summaryrefslogtreecommitdiff
path: root/src/location/declarativemaps/qdeclarativegeoroute_p.h
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2018-06-28 10:45:16 +0200
committerPaolo Angelelli <paolo.angelelli@qt.io>2018-08-24 11:54:22 +0000
commit0a6315b7a2a00d56a101c4a2ea165242d356e024 (patch)
treec7b9a313f4e001d243d7b796129894b026a53be2 /src/location/declarativemaps/qdeclarativegeoroute_p.h
parent34ee76720ee09ac692ea149ce44413cb5c0c7b99 (diff)
downloadqtlocation-0a6315b7a2a00d56a101c4a2ea165242d356e024.tar.gz
Add support for route legs
This patch adds support for route legs, that are the portions of a route between one waypoint and the next. QGeoRouteLeg in particular can be seen as an API addition to QGeoRoute in that it uses and exposes additional methods added to QGeoRoutePrivate but not used in QGeoRoute. Currently the request for legs is set to be the same as the request for the entire route. Finding the related bounding waypoints has to be done programmatically using the legIndex property. Change-Id: If462b1dc6348be16dc96b167db5500f079fe0a64 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/location/declarativemaps/qdeclarativegeoroute_p.h')
-rw-r--r--src/location/declarativemaps/qdeclarativegeoroute_p.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/location/declarativemaps/qdeclarativegeoroute_p.h b/src/location/declarativemaps/qdeclarativegeoroute_p.h
index fa9025d8..98d08e98 100644
--- a/src/location/declarativemaps/qdeclarativegeoroute_p.h
+++ b/src/location/declarativemaps/qdeclarativegeoroute_p.h
@@ -68,6 +68,7 @@ class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoRoute : public QObject
Q_PROPERTY(QJSValue path READ path WRITE setPath NOTIFY pathChanged)
Q_PROPERTY(QQmlListProperty<QDeclarativeGeoRouteSegment> segments READ segments CONSTANT)
Q_PROPERTY(QDeclarativeGeoRouteQuery *routeQuery READ routeQuery REVISION 11)
+ Q_PROPERTY(QList<QObject *> legs READ legs CONSTANT REVISION 12)
public:
explicit QDeclarativeGeoRoute(QObject *parent = 0);
@@ -89,6 +90,7 @@ public:
int segmentsCount() const;
const QGeoRoute &route() const;
QDeclarativeGeoRouteQuery *routeQuery();
+ QList<QObject *> legs();
Q_INVOKABLE bool equals(QDeclarativeGeoRoute *other) const;
@@ -107,10 +109,30 @@ private:
QGeoRoute route_;
QDeclarativeGeoRouteQuery *routeQuery_ = nullptr;
QList<QDeclarativeGeoRouteSegment *> segments_;
- bool segmentsDirty_;
+ QList<QObject *> legs_;
+ bool segmentsDirty_ = true;
friend class QDeclarativeRouteMapItem;
};
+class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoRouteLeg : public QDeclarativeGeoRoute
+{
+ Q_OBJECT
+
+ Q_PROPERTY(int legIndex READ legIndex CONSTANT)
+ Q_PROPERTY(QObject * overallRoute READ overallRoute CONSTANT)
+
+public:
+ explicit QDeclarativeGeoRouteLeg(QObject *parent = nullptr);
+ QDeclarativeGeoRouteLeg(const QGeoRouteLeg &routeLeg, QObject *parent = nullptr);
+ ~QDeclarativeGeoRouteLeg() override;
+
+ int legIndex() const;
+ QObject *overallRoute() const;
+
+private:
+ QGeoRouteLeg m_routeLeg;
+};
+
QT_END_NAMESPACE
#endif