summaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/sensors/sensors.cpp3
-rw-r--r--src/imports/sensors2/sensors2.cpp5
2 files changed, 7 insertions, 1 deletions
diff --git a/src/imports/sensors/sensors.cpp b/src/imports/sensors/sensors.cpp
index b81bdd3d..f65af6a2 100644
--- a/src/imports/sensors/sensors.cpp
+++ b/src/imports/sensors/sensors.cpp
@@ -106,6 +106,9 @@ public:
int major;
int minor;
+ // Force all of the sensors initialization to happen now, while we don't have a UI thread to interrupt
+ (void)QSensor::sensorTypes();
+
// Register the 1.1 interfaces
major = 1;
minor = 1;
diff --git a/src/imports/sensors2/sensors2.cpp b/src/imports/sensors2/sensors2.cpp
index ebcefcfb..190ecde0 100644
--- a/src/imports/sensors2/sensors2.cpp
+++ b/src/imports/sensors2/sensors2.cpp
@@ -57,8 +57,11 @@ public:
virtual void registerTypes(const char *uri)
{
qDebug() << "QSensors2DeclarativeModule::registerTypes(const char *uri)";
-
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtSensors"));
+
+ // Force all of the sensors initialization to happen now, while we don't have a UI thread to interrupt
+ (void)QSensor::sensorTypes();
+
qmlRegisterUncreatableType<qsensor2common >(uri, 5, 0, "Sensor", QLatin1String("Cannot create Sensor"));
qmlRegisterType <QSensor2Tilt >(uri, 5, 0, "TiltSensor");
qmlRegisterType <QSensor2AmbientLight>(uri, 5, 0, "AmbientLightSensor");