diff options
author | Juha Vuolle <juha.vuolle@insta.fi> | 2021-04-27 14:20:52 +0300 |
---|---|---|
committer | Juha Vuolle <juha.vuolle@insta.fi> | 2021-04-27 20:18:56 +0300 |
commit | cc40b86d2b5b9943fa6ee011faa3cbcf9248e660 (patch) | |
tree | d45aabedb80256fa66fdc9a313507d26f088f585 /examples/sensors | |
parent | 254760acc0be8a193282cc8b7dbc629ad54eb33c (diff) |
Enable sensor_explorer example standalone build
This commit enables building of the example outside of the source tree.
Currently the example does not work with Qt 6.2 but requires
more "content work" that shall be done under QTBUG-92514
Also removed the Widgets related code as the example is a
Quick application.
Task-number: QTBUG-92502
Change-Id: I016cf6697dc4603c77437c7f20601937b1fca293
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'examples/sensors')
-rw-r--r-- | examples/sensors/sensor_explorer/import/CMakeLists.txt | 6 | ||||
-rw-r--r-- | examples/sensors/sensor_explorer/main.cpp | 9 | ||||
-rw-r--r-- | examples/sensors/sensor_explorer/sensor_explorer.qml | 4 |
3 files changed, 10 insertions, 9 deletions
diff --git a/examples/sensors/sensor_explorer/import/CMakeLists.txt b/examples/sensors/sensor_explorer/import/CMakeLists.txt index 57ae2040..306e1b7c 100644 --- a/examples/sensors/sensor_explorer/import/CMakeLists.txt +++ b/examples/sensors/sensor_explorer/import/CMakeLists.txt @@ -15,7 +15,11 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/sensor_explorer/Explorer" find_package(Qt6 COMPONENTS Core Gui Qml Sensors) -if (MACOS) +# Hack to convince qt6_add_qml_module to respect the shared-ness of a Qt build +# TODO Qt 6.2 FIXME when a proper fix is available +set(BUILD_SHARED_LIBS "${QT6_IS_SHARED_LIBS_BUILD}") + +if (APPLE AND NOT IOS) set(PLUGIN_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../sensor_explorer.app/Contents/MacOS/Explorer") else() set(PLUGIN_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../Explorer") diff --git a/examples/sensors/sensor_explorer/main.cpp b/examples/sensors/sensor_explorer/main.cpp index bb0a3b17..418b85e3 100644 --- a/examples/sensors/sensor_explorer/main.cpp +++ b/examples/sensors/sensor_explorer/main.cpp @@ -50,18 +50,11 @@ #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); + QGuiApplication app(argc, argv); QQmlApplicationEngine engine(QUrl("qrc:///sensor_explorer.qml")); QObject *topLevel = engine.rootObjects().value(0); QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel); diff --git a/examples/sensors/sensor_explorer/sensor_explorer.qml b/examples/sensors/sensor_explorer/sensor_explorer.qml index 24e22133..c8b9e538 100644 --- a/examples/sensors/sensor_explorer/sensor_explorer.qml +++ b/examples/sensors/sensor_explorer/sensor_explorer.qml @@ -74,11 +74,14 @@ Window { anchors.margins: 8 spacing: 8 + /* TODO Qt 6.2 FIX TableView and TableViewColumn + GroupBox { title: qsTr("Available Sensors") width: parent.width height: window.height * 0.4 + TableView { id: sensorList anchors.fill: parent @@ -220,5 +223,6 @@ Window { } } } + */ } } |