quick example: add some comments

explain some more

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2022-04-01 14:22:45 +08:00
parent 6166422e37
commit 8bc08ab32f
1 changed files with 14 additions and 5 deletions

View File

@ -44,18 +44,27 @@ int main(int argc, char *argv[])
QGuiApplication application(argc, argv); QGuiApplication application(argc, argv);
#ifdef Q_OS_WINDOWS // Allow testing other RHI backends through environment variable.
if (!qEnvironmentVariableIsSet("QSG_RHI_BACKEND")) { 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); 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); QQuickWindow::setSceneGraphBackend(QSGRendererInterface::Software);
# endif
}
#endif #endif
}
QQmlApplicationEngine engine; 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)) #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
QQuickStyle::setStyle(FRAMELESSHELPER_STRING_LITERAL("Basic")); QQuickStyle::setStyle(FRAMELESSHELPER_STRING_LITERAL("Basic"));
#else #else