diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-10-25 10:06:26 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-10-25 11:13:40 +0200 |
commit | 972c6fddd0087987ba0a2093d196b8e898f82186 (patch) | |
tree | b69b4a4d29b2b6a4653533352e0d7ced905cc6b4 /examples/sensors/sensor_explorer/import/main.cpp | |
parent | 181d9ce15c0b2496949017eb1261c20a47642b16 (diff) |
Enable shadow-building the sensor_explorer example on Windows
When package-testing, a shadow-build of the example fails due to
the import plugin not finding "main.moc", which is apparently
caused by the directory structure and using
DESTDIR = ./
Add header "main.h" to avoid having to deal with "main.moc".
Change-Id: I04024c8d282b4f56d9942c0c8414d0b6ff9b1d20
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'examples/sensors/sensor_explorer/import/main.cpp')
-rw-r--r-- | examples/sensors/sensor_explorer/import/main.cpp | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/examples/sensors/sensor_explorer/import/main.cpp b/examples/sensors/sensor_explorer/import/main.cpp index b43ea339..4199b2f4 100644 --- a/examples/sensors/sensor_explorer/import/main.cpp +++ b/examples/sensors/sensor_explorer/import/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtSensors module of the Qt Toolkit. @@ -48,28 +48,18 @@ ** ****************************************************************************/ -#include <QtQml/QQmlExtensionPlugin> -#include <QtQml/QtQml> +#include "main.h" #include "explorer.h" -#include <QtCore/QDebug> QT_BEGIN_NAMESPACE -class SensorExplorerDeclarativeModule : public QQmlExtensionPlugin +void SensorExplorerDeclarativeModule::registerTypes(const char *uri) { - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid FILE "import.json") -public: - void registerTypes(const char *uri) override - { - Q_ASSERT(QLatin1String(uri) == QLatin1String("Explorer")); - // @uri Explorer - qmlRegisterType<QSensorExplorer>(uri, 1, 0, "SensorExplorer"); - qmlRegisterType<QSensorItem>(uri, 1, 0, "SensorItem"); - qmlRegisterType<QPropertyInfo>(uri, 1, 0, "PropertyInfo"); - } -}; + Q_ASSERT(QLatin1String(uri) == QLatin1String("Explorer")); + // @uri Explorer + qmlRegisterType<QSensorExplorer>(uri, 1, 0, "SensorExplorer"); + qmlRegisterType<QSensorItem>(uri, 1, 0, "SensorItem"); + qmlRegisterType<QPropertyInfo>(uri, 1, 0, "PropertyInfo"); +} QT_END_NAMESPACE - -#include "main.moc" |