summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2017-08-24 16:47:32 +0200
committerPaolo Angelelli <paolo.angelelli@qt.io>2017-08-30 14:19:59 +0000
commit18b22e3b8e07871232a39f69d3cd603b5c5b6e0d (patch)
treeb9e7c04778219765d458214a08d75e85c4a1087e /src
parent6024168ef21dd4fe6c5ddd7e837d56076e886e01 (diff)
downloadqtlocation-18b22e3b8e07871232a39f69d3cd603b5c5b6e0d.tar.gz
Fix PositionSource never turning active on android
It seems that if m_positionSource gets created too late, PositionSource never becomes active so it never starts pushing position updates. Task-number: QTBUG-62778 Change-Id: I7b375e9f9f1fbe546dfc27fa6bf0c431df393e65 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/imports/positioning/qdeclarativepositionsource.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/imports/positioning/qdeclarativepositionsource.cpp b/src/imports/positioning/qdeclarativepositionsource.cpp
index b0e990da..05232d51 100644
--- a/src/imports/positioning/qdeclarativepositionsource.cpp
+++ b/src/imports/positioning/qdeclarativepositionsource.cpp
@@ -559,10 +559,9 @@ QDeclarativePositionSource::PositioningMethods QDeclarativePositionSource::prefe
void QDeclarativePositionSource::start()
{
- if (!m_positionSource)
- return;
+ if (m_positionSource)
+ m_positionSource->startUpdates();
- m_positionSource->startUpdates();
if (!m_active) {
m_active = true;
emit activeChanged();
@@ -721,6 +720,12 @@ void QDeclarativePositionSource::componentComplete()
static_cast<QGeoPositionInfoSource::PositioningMethods>(int(m_preferredPositioningMethods)));
setPosition(m_positionSource->lastKnownPosition());
+
+ if (m_active)
+ QTimer::singleShot(0, this, SLOT(start())); // delay ensures all properties have been set
+ } else if (m_active) {
+ m_active = false;
+ emit activeChanged();
}
if (previousUpdateInterval != updateInterval())
@@ -733,12 +738,6 @@ void QDeclarativePositionSource::componentComplete()
emit supportedPositioningMethodsChanged();
emit validityChanged();
-
- if (m_active) {
- m_active = false;
- emit activeChanged();
- }
-
emit nameChanged();
}
}