From 6e111f96e307501ec02a620fa3124fd3ce9c9193 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Thu, 30 Jan 2020 15:43:57 +0100 Subject: Add support for file selectors to qml tool This allows defining file selectors using a command-line option. [ChangeLog][QtQml][qml] The QML Runtime tool --selector option now allows defining a custom QQmlFileSelector. Change-Id: I1be5efd273b2f387df72b1d5057f7281e5c0c156 Reviewed-by: Shawn Rutledge --- tools/qml/main.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tools/qml') diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 4c613e4ab4..9f5aacb1dd 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -59,6 +59,7 @@ #include #include #include +#include #include #include @@ -511,6 +512,9 @@ int main(int argc, char *argv[]) "Backend is one of: default, vulkan, metal, d3d11, gl"), QStringLiteral("backend")); parser.addOption(rhiOption); + QCommandLineOption selectorOption(QStringLiteral("S"), QCoreApplication::translate("main", + "Add selector to the list of QQmlFileSelectors."), QStringLiteral("selector")); + parser.addOption(selectorOption); // Positional arguments parser.addPositionalArgument("files", @@ -550,6 +554,15 @@ int main(int argc, char *argv[]) #endif for (const QString &importPath : parser.values(importOption)) e.addImportPath(importPath); + + QStringList customSelectors; + for (const QString &selector : parser.values(selectorOption)) + customSelectors.append(selector); + if (!customSelectors.isEmpty()) { + QQmlFileSelector *selector = QQmlFileSelector::get(&e); + selector->setExtraSelectors(customSelectors); + } + files << parser.values(qmlFileOption); if (parser.isSet(configOption)) confFile = parser.value(configOption); -- cgit v1.2.3 From 3c2439593460d665dcf64622afae4eb91993eb10 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Thu, 30 Jan 2020 15:54:09 +0100 Subject: Add QML_CORE_PROFILE support to QML tool If QML_CORE_PROFILE is defined we use the CoreProfile surface format. This is required for QtQuick3D. For consistency we also introduce QSG_CORE_PROFILE. Adding QSG_CORE_PROFILE also to qmlscene. Change-Id: I4feee91740162cf36fa2668695b74f5a1279bb89 Reviewed-by: Laszlo Agocs --- tools/qml/main.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tools/qml') diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 9f5aacb1dd..dc828b1f75 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #ifdef QT_WIDGETS_LIB #include #endif // QT_WIDGETS_LIB @@ -563,6 +564,17 @@ int main(int argc, char *argv[]) selector->setExtraSelectors(customSelectors); } +#if defined(QT_GUI_LIB) && QT_CONFIG(opengl) + if (qEnvironmentVariableIsSet("QSG_CORE_PROFILE") || qEnvironmentVariableIsSet("QML_CORE_PROFILE")) { + QSurfaceFormat surfaceFormat; + surfaceFormat.setStencilBufferSize(8); + surfaceFormat.setDepthBufferSize(24); + surfaceFormat.setVersion(4, 1); + surfaceFormat.setProfile(QSurfaceFormat::CoreProfile); + QSurfaceFormat::setDefaultFormat(surfaceFormat); + } +#endif + files << parser.values(qmlFileOption); if (parser.isSet(configOption)) confFile = parser.value(configOption); -- cgit v1.2.3