summaryrefslogtreecommitdiffstats
path: root/examples/sensors/sensor_explorer/main.cpp
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@digia.com>2013-08-28 11:26:38 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-11 11:35:00 +0100
commita840cbffba476205eba81f56f40ec32cea6097cc (patch)
tree1c8f0b294884aaedc03e5eb49a4918c0a7d8326f /examples/sensors/sensor_explorer/main.cpp
parente3af89e2630bba68d3f10a33bccdd19bbc46664d (diff)
Doc: Update Sensor Explorer example
Following changes are made to the example - Use of Qt Quick Controls / TableView to present the sensor information, reducing the example to a single QML file - Updated launcher main.cpp for the QML example - Remove separate example doc for the import subproject - Various fixes to example doc, add a screenshot - Ensure import module + qmldir are built/deployed to correct location Task-number: QTBUG-32881 Task-number: QTBUG-33875 Change-Id: I0ed7c7ebc916fcad6da5e3c66d81be8f348a93e1 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Diffstat (limited to 'examples/sensors/sensor_explorer/main.cpp')
-rw-r--r--examples/sensors/sensor_explorer/main.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/examples/sensors/sensor_explorer/main.cpp b/examples/sensors/sensor_explorer/main.cpp
index 34f5ba3c..066f559c 100644
--- a/examples/sensors/sensor_explorer/main.cpp
+++ b/examples/sensors/sensor_explorer/main.cpp
@@ -38,5 +38,27 @@
**
****************************************************************************/
-#include "../stub.h"
-SENSORS_EXAMPLE_MAIN(sensor_explorer)
+#include <QtQml>
+#include <QtQuick/QQuickWindow>
+
+#ifndef QT_NO_WIDGETS
+#include <QtWidgets/QApplication>
+#define Application QApplication
+#else
+#include <QtGui/QGuiApplication>
+#define Application QGuiApplication
+#endif
+
+int main(int argc, char *argv[])
+{
+ Application app(argc, argv);
+ QQmlApplicationEngine engine(QUrl("qrc:///sensor_explorer.qml"));
+ QObject *topLevel = engine.rootObjects().value(0);
+ QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
+ if (!window) {
+ qWarning("Error: Your root item has to be a Window.");
+ return -1;
+ }
+ window->show();
+ return app.exec();
+}