diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-07-11 14:51:40 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-07-11 17:24:39 +0200 |
commit | 13374ceb165c44658aa97890c37b206859c9a31c (patch) | |
tree | 562362b196a459ee3449a5a1e60e5216a9dd6984 /tools/qml/main.cpp | |
parent | ae47deba4c943c496412530a8d2a5a688ae12038 (diff) | |
parent | b5d18be5a03406d0aac83856dd41e1525fd14a28 (diff) |
Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
Change-Id: I2963c1209316fb6755f572969f368970450d7991
Diffstat (limited to 'tools/qml/main.cpp')
-rw-r--r-- | tools/qml/main.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 1e367d91bf..9edc90e050 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -494,6 +494,12 @@ int main(int argc, char *argv[]) QCommandLineOption fixedAnimationsOption(QStringLiteral("fixed-animations"), QCoreApplication::translate("main", "Run animations off animation tick rather than wall time.")); parser.addOption(fixedAnimationsOption); + QCommandLineOption rhiOption(QStringList() << QStringLiteral("r") << QStringLiteral("rhi"), + QCoreApplication::translate("main", "Use the Qt graphics abstraction (RHI) instead of OpenGL directly. " + "Backend is one of: default, vulkan, metal, d3d11, gl"), + QStringLiteral("backend")); + parser.addOption(rhiOption); + // Positional arguments parser.addPositionalArgument("files", QCoreApplication::translate("main", "Any number of QML files can be loaded. They will share the same engine."), "[files...]"); @@ -549,6 +555,14 @@ int main(int argc, char *argv[]) translationFile = parser.value(translationOption); if (parser.isSet(dummyDataOption)) dummyDir = parser.value(dummyDataOption); + if (parser.isSet(rhiOption)) { + qputenv("QSG_RHI", "1"); + const QString rhiBackend = parser.value(rhiOption); + if (rhiBackend == QLatin1String("default")) + qunsetenv("QSG_RHI_BACKEND"); + else + qputenv("QSG_RHI_BACKEND", rhiBackend.toLatin1()); + } for (QString posArg : parser.positionalArguments()) { if (posArg == QLatin1String("--")) break; |