diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2019-01-29 18:56:06 +0100 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2019-02-01 14:09:50 +0000 |
commit | 265f2b75b86337287880290593b3c411ad5fa7a1 (patch) | |
tree | 40d5152fa2899cc0478d034a7dc3628c34ba9d84 /src/location/labs | |
parent | 587b8812c9b2fc7ed7ad4ab35d27114ee98eafc6 (diff) | |
download | qtlocation-265f2b75b86337287880290593b3c411ad5fa7a1.tar.gz |
Expose QAbstractNavigator
This change exposes the QAbstractNavigator instantiated by
QDeclarativeNavigator. By doing so, it is possible to expose to the user
engine-specific features and data via properties, signals and methods
added to the QAbstractNavigator subclass.
However, while this approach greatly simplifies the exposure of
such features, it also leads to writing non-cross-plugin code.
Change-Id: I03be9b6d0868d940dc0ac80520f3b507bec2953a
Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
Diffstat (limited to 'src/location/labs')
-rw-r--r-- | src/location/labs/qdeclarativenavigator.cpp | 15 | ||||
-rw-r--r-- | src/location/labs/qdeclarativenavigator_p.h | 3 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/location/labs/qdeclarativenavigator.cpp b/src/location/labs/qdeclarativenavigator.cpp index 2fab9144..5dfdfdbe 100644 --- a/src/location/labs/qdeclarativenavigator.cpp +++ b/src/location/labs/qdeclarativenavigator.cpp @@ -297,6 +297,21 @@ QString QDeclarativeNavigator::errorString() const return d_ptr->m_errorString; } +/* !NOT DOCUMENTED YET! + \qmlproperty QAbstractNavigator *Qt.labs.location::Navigator::engineHandle + + This property returns a handle to the navigation object created by the engine. + This object can carry engine-specific properties, signals and methods, to expose + engine-specific features and data. + + \note Using this property leads to writing code that won't work with different plugins. +*/ +QAbstractNavigator *QDeclarativeNavigator::abstractNavigator() const +{ + return d_ptr->m_navigator.data(); + +} + bool QDeclarativeNavigator::active() const { return d_ptr->m_active; diff --git a/src/location/labs/qdeclarativenavigator_p.h b/src/location/labs/qdeclarativenavigator_p.h index 17f8e687..e12d6ba4 100644 --- a/src/location/labs/qdeclarativenavigator_p.h +++ b/src/location/labs/qdeclarativenavigator_p.h @@ -69,6 +69,7 @@ class QGeoRouteSegment; class QDeclarativeNavigatorPrivate; class QDeclarativeGeoRouteSegment; class QDeclarativeNavigationBasicDirections; +class QAbstractNavigator; class Q_LOCATION_PRIVATE_EXPORT QDeclarativeNavigator : public QParameterizableObject, public QQmlParserStatus { @@ -83,6 +84,7 @@ class Q_LOCATION_PRIVATE_EXPORT QDeclarativeNavigator : public QParameterizableO Q_PROPERTY(QDeclarativeNavigationBasicDirections *directions READ directions CONSTANT) Q_PROPERTY(NavigationError error READ error NOTIFY errorChanged) Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged) + Q_PROPERTY(QAbstractNavigator *engineHandle READ abstractNavigator CONSTANT) Q_INTERFACES(QQmlParserStatus) @@ -133,6 +135,7 @@ public: bool trackPositionSource() const; QDeclarativeNavigationBasicDirections *directions() const; + QAbstractNavigator *abstractNavigator() const; NavigationError error() const; QString errorString() const; |