summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2018-06-20 14:10:36 +0300
committerBruno de Oliveira Abinader <brunoabinader@gmail.com>2018-06-26 09:16:06 +0000
commit178d6a3295336a43c33b8d39cfd36de638e9d4f4 (patch)
tree3d9067fde1d7e0a9488387c5d8017f46f4532adc
parent350708b2027b433b02a6ec608020e33a34630750 (diff)
downloadqtlocation-178d6a3295336a43c33b8d39cfd36de638e9d4f4.tar.gz
Add Qt.labs.location::Navigator::trackPositionSource property
This property tells whether the Navigator should control the Map camera to keep track of position source updates. This property is enabled by default, and setting it to false is useful in cases where e.g. the user starts gesturing over the map area. Task-number: QTBUG-69031 Change-Id: I86157f69890f8cf0eb60d457d0f9c4134e2befb0 Reviewed-by: BogDan Vatra <bogdan@kdab.com> Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
-rw-r--r--src/location/labs/qdeclarativenavigator.cpp28
-rw-r--r--src/location/labs/qdeclarativenavigator_p.h5
-rw-r--r--src/location/labs/qdeclarativenavigator_p_p.h1
3 files changed, 34 insertions, 0 deletions
diff --git a/src/location/labs/qdeclarativenavigator.cpp b/src/location/labs/qdeclarativenavigator.cpp
index 5fe36bb8..7dba341e 100644
--- a/src/location/labs/qdeclarativenavigator.cpp
+++ b/src/location/labs/qdeclarativenavigator.cpp
@@ -126,6 +126,19 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \qmlproperty bool Qt.labs.location::Navigator::trackPositionSource
+
+ This property tells whether the Navigator should control the Map camera to
+ keep track of position source updates. This property is enabled (\c true) by
+ default, and setting it to \c false is useful in cases where e.g. the user
+ starts gesturing over the map area.
+
+ Navigator plugins can also control this property directly e.g. user map
+ interaction could trigger the property change. Honoring the user-specified
+ value of this property is plugin dependent.
+*/
+
+/*!
\qmlproperty Route Qt.labs.location::Navigator::currentRoute
This read-only property holds the current route the navigator following.
@@ -284,6 +297,21 @@ bool QDeclarativeNavigator::navigatorReady() const
return d_ptr->m_ready;
}
+bool QDeclarativeNavigator::trackPositionSource() const
+{
+ return d_ptr->m_trackPositionSource;
+}
+
+void QDeclarativeNavigator::setTrackPositionSource(bool trackPositionSource)
+{
+ if (trackPositionSource == d_ptr->m_trackPositionSource)
+ return;
+
+ d_ptr->m_trackPositionSource = trackPositionSource;
+
+ emit trackPositionSourceChanged(trackPositionSource);
+}
+
QDeclarativeGeoRoute *QDeclarativeNavigator::currentRoute() const
{
if (!d_ptr->m_ready || !d_ptr->m_navigationManager->active())
diff --git a/src/location/labs/qdeclarativenavigator_p.h b/src/location/labs/qdeclarativenavigator_p.h
index 0373bf57..3c83ec94 100644
--- a/src/location/labs/qdeclarativenavigator_p.h
+++ b/src/location/labs/qdeclarativenavigator_p.h
@@ -75,6 +75,7 @@ class Q_LOCATION_PRIVATE_EXPORT QDeclarativeNavigator : public QParameterizableO
Q_PROPERTY(QDeclarativePositionSource *positionSource READ positionSource WRITE setPositionSource NOTIFY positionSourceChanged)
Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
Q_PROPERTY(bool navigatorReady READ navigatorReady NOTIFY navigatorReadyChanged)
+ Q_PROPERTY(bool trackPositionSource READ trackPositionSource WRITE setTrackPositionSource NOTIFY trackPositionSourceChanged)
Q_PROPERTY(QDeclarativeGeoRoute *currentRoute READ currentRoute NOTIFY currentRouteChanged)
Q_PROPERTY(int currentSegment READ currentSegment NOTIFY currentSegmentChanged)
Q_INTERFACES(QQmlParserStatus)
@@ -109,11 +110,15 @@ public:
QNavigationManager *navigationManager() const;
bool navigatorReady() const;
+ void setTrackPositionSource(bool trackPositionSource);
+ bool trackPositionSource() const;
+
QDeclarativeGeoRoute *currentRoute() const;
int currentSegment() const;
signals:
void navigatorReadyChanged(bool ready);
+ void trackPositionSourceChanged(bool trackPositionSource);
void activeChanged(bool active);
void waypointReached(const QDeclarativeGeoWaypoint *pos);
void destinationReached();
diff --git a/src/location/labs/qdeclarativenavigator_p_p.h b/src/location/labs/qdeclarativenavigator_p_p.h
index c4198714..3710054e 100644
--- a/src/location/labs/qdeclarativenavigator_p_p.h
+++ b/src/location/labs/qdeclarativenavigator_p_p.h
@@ -84,6 +84,7 @@ public:
bool m_active = false;
bool m_completed = false;
bool m_ready = false;
+ bool m_trackPositionSource = true;
};
QT_END_NAMESPACE