diff options
author | 2024-09-10 19:15:25 +0900 | |
---|---|---|
committer | 2024-09-11 18:40:18 +0900 | |
commit | 5c8f09d2c3c99f621b467ed5c1be4fac3a708e85 (patch) | |
tree | 9312e269961b14945a00db47ed236ca53ffbb149 /Application/main.cpp | |
parent | 17b016d08cf1680f58cbb9102f35949c8436207c (diff) |
Port the cluster-refgui demo supports both Qt5 and Qt6HEADtrout_19.90.0trout/19.90.019.90.0master
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 <shanheng.jiu@qt.io>
Diffstat (limited to 'Application/main.cpp')
-rw-r--r-- | Application/main.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
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 <QDebug> +#include <QDir> +#include <QDirIterator> #include <QGuiApplication> #include <QQmlApplicationEngine> -#include <QSurfaceFormat> -#include <QDir> #include <QQmlContext> -#include <QDebug> - +#include <QSurfaceFormat> +#if QT_VERSION >= 0x060000 +#include <QQuickWindow> +#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); |