From 8bc08ab32f5388b69bb335a1cf686bd721a094d0 Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Fri, 1 Apr 2022 14:22:45 +0800 Subject: [PATCH] quick example: add some comments explain some more Signed-off-by: Yuhang Zhao <2546789017@qq.com> --- examples/quick/main.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/examples/quick/main.cpp b/examples/quick/main.cpp index b90ddc7..cffbd6c 100644 --- a/examples/quick/main.cpp +++ b/examples/quick/main.cpp @@ -44,18 +44,27 @@ int main(int argc, char *argv[]) QGuiApplication application(argc, argv); -#ifdef Q_OS_WINDOWS + // Allow testing other RHI backends through environment variable. if (!qEnvironmentVariableIsSet("QSG_RHI_BACKEND")) { -# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) + // This line is not relevant to FramelessHelper, we change + // the default RHI backend to "software" just because it's + // stable enough and have exactly the same behavior on all + // supported platforms. Other backends may behave differently + // on different platforms and graphics cards, so I think they + // are not suitable for our demonstration. +#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) QQuickWindow::setGraphicsApi(QSGRendererInterface::Software); -# elif (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) +#elif (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) QQuickWindow::setSceneGraphBackend(QSGRendererInterface::Software); -# endif - } #endif + } QQmlApplicationEngine engine; + // This line is not relevant to FramelessHelper, we change the default + // Qt Quick Controls theme to "Basic" (Qt6) or "Default" (Qt5) just + // because other themes will make our homemade system buttons look + // not good. This line has nothing to do with FramelessHelper itself. #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) QQuickStyle::setStyle(FRAMELESSHELPER_STRING_LITERAL("Basic")); #else