diff options
author | Tamás Martinec <tamas.martinec@symbio.com> | 2021-04-30 10:55:25 +0300 |
---|---|---|
committer | Tamás Martinec <tamas.martinec@symbio.com> | 2021-04-30 16:00:53 +0300 |
commit | 61463edb08fb97778e359ecfcd960fcd5ba9fd33 (patch) | |
tree | 44724696c17f2904f4fd3d623660382868377f22 /src | |
parent | f828d901eeb539a2756ea4c0cb613d55d04ca8e6 (diff) |
QtSensors: Fix iOS sensor backend loading
Setting the default backend to the last registered
backend if the current default is a dummy backend.
Task-number: QTBUG-92508
Change-Id: Id67625544f0da2dae118998429c0aeeee2a94cb2
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
Diffstat (limited to 'src')
-rw-r--r-- | src/sensors/qsensormanager.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/sensors/qsensormanager.cpp b/src/sensors/qsensormanager.cpp index b04c7375..e49e5281 100644 --- a/src/sensors/qsensormanager.cpp +++ b/src/sensors/qsensormanager.cpp @@ -253,6 +253,9 @@ void QSensorManagerPrivate::loadPlugins() Register a sensor for \a type. The \a identifier must be unique. The \a factory will be asked to create instances of the backend. + + Sensor identifiers starting with \c generic or \c dummy are given lower + priority when choosing the default sensor if other sensors are found. */ void QSensorManager::registerBackend(const QByteArray &type, const QByteArray &identifier, QSensorBackendFactory *factory) { @@ -264,8 +267,9 @@ void QSensorManager::registerBackend(const QByteArray &type, const QByteArray &i if (!d->backendsByType.contains(type)) { (void)d->backendsByType[type]; d->firstIdentifierForType[type] = identifier; - } else if (d->firstIdentifierForType[type].startsWith("generic.")) { - // Don't let a generic backend be the default when some other backend exists! + } else if (d->firstIdentifierForType[type].startsWith("generic.") || + d->firstIdentifierForType[type].startsWith("dummy.")) { + // Don't let a generic or dummy backend be the default when some other backend exists! d->firstIdentifierForType[type] = identifier; } FactoryForIdentifierMap &factoryByIdentifier = d->backendsByType[type]; |