From 5c8f09d2c3c99f621b467ed5c1be4fac3a708e85 Mon Sep 17 00:00:00 2001 From: Jiu Shanheng Date: Tue, 10 Sep 2024 19:15:25 +0900 Subject: Port the cluster-refgui demo supports both Qt5 and Qt6 This demo can now run on both Qt5 and Qt6, also added a macro to switch with or without the backend so that it can be developed easily on the Windows desktop. Bug-AGL: SPEC-5243 Change-Id: I99b12ad9779a477784df13b83a850387747bb588 Signed-off-by: Jiu Shanheng --- Application/main.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'Application/main.cpp') diff --git a/Application/main.cpp b/Application/main.cpp index 51b0c39..1593d25 100644 --- a/Application/main.cpp +++ b/Application/main.cpp @@ -14,17 +14,21 @@ * limitations under the License. */ +#include +#include +#include #include #include -#include -#include #include -#include - +#include +#if QT_VERSION >= 0x060000 +#include +#endif #include "cluster-service.hxx" int main(int argc, char *argv[]) { +#ifdef CROSSCOMPILING QSurfaceFormat defaultFormat; defaultFormat.setSwapBehavior(QSurfaceFormat::TripleBuffer); defaultFormat.setRenderableType(QSurfaceFormat::OpenGLES); @@ -34,6 +38,17 @@ int main(int argc, char *argv[]) defaultFormat.setDepthBufferSize(8); defaultFormat.setAlphaBufferSize(8); QSurfaceFormat::setDefaultFormat(defaultFormat); +#endif + +#if QT_VERSION >= 0x060000 + QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL); + qputenv("QT_ENABLE_HIGHDPI_SCALING", "0"); +#endif + + QDirIterator it(":", QDirIterator::Subdirectories); + while (it.hasNext()) { + qDebug() << it.next(); + } QGuiApplication app(argc, argv); -- cgit