From cc40b86d2b5b9943fa6ee011faa3cbcf9248e660 Mon Sep 17 00:00:00 2001 From: Juha Vuolle Date: Tue, 27 Apr 2021 14:20:52 +0300 Subject: 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 --- examples/sensors/sensor_explorer/import/CMakeLists.txt | 6 +++++- examples/sensors/sensor_explorer/main.cpp | 9 +-------- examples/sensors/sensor_explorer/sensor_explorer.qml | 4 ++++ 3 files changed, 10 insertions(+), 9 deletions(-) (limited to 'examples') 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 #include - -#ifndef QT_NO_WIDGETS -#include -#define Application QApplication -#else #include -#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(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 { } } } + */ } } -- cgit v1.2.3