diff options
author | Qt Forward Merge Bot <[email protected]> | 2019-06-28 13:28:09 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <[email protected]> | 2019-06-28 13:28:10 +0200 |
commit | 63398defdbec12979b61120f690e984af0496c37 (patch) | |
tree | ab7a29ea0040d46c47004fed3c211a831bc48e9c /tools/qmlscene/main.cpp | |
parent | cff8d9f1d2d309cd9417bb93386a1443ed1892c3 (diff) | |
parent | 692b2da77427259a3589cf8a1311075863f2f5ec (diff) |
Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I59343fe228ca6b823b61577e5a0907e7381899c2
Diffstat (limited to 'tools/qmlscene/main.cpp')
-rw-r--r-- | tools/qmlscene/main.cpp | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp index d64272d417..af50acaa5a 100644 --- a/tools/qmlscene/main.cpp +++ b/tools/qmlscene/main.cpp @@ -477,6 +477,12 @@ int main(int argc, char ** argv) options.applicationAttributes.append(Qt::AA_EnableHighDpiScaling); } else if (!qstrcmp(arg, "--no-scaling")) { options.applicationAttributes.append(Qt::AA_DisableHighDpiScaling); + } else if (!qstrcmp(arg, "--transparent")) { + options.transparent = true; + } else if (!qstrcmp(arg, "--multisample")) { + options.multisample = true; + } else if (!qstrcmp(arg, "--core-profile")) { + options.coreProfile = true; } else if (!qstrcmp(arg, "--apptype")) { if (++i >= argc) usage(); @@ -485,6 +491,23 @@ int main(int argc, char ** argv) } } + if (qEnvironmentVariableIsSet("QMLSCENE_CORE_PROFILE")) + options.coreProfile = true; + + // Set default surface format before creating the window + QSurfaceFormat surfaceFormat; + surfaceFormat.setStencilBufferSize(8); + surfaceFormat.setDepthBufferSize(24); + if (options.multisample) + surfaceFormat.setSamples(16); + if (options.transparent) + surfaceFormat.setAlphaBufferSize(8); + if (options.coreProfile) { + surfaceFormat.setVersion(4, 1); + surfaceFormat.setProfile(QSurfaceFormat::CoreProfile); + } + QSurfaceFormat::setDefaultFormat(surfaceFormat); + for (Qt::ApplicationAttribute a : qAsConst(options.applicationAttributes)) QCoreApplication::setAttribute(a); QScopedPointer<QGuiApplication> app; @@ -499,9 +522,6 @@ int main(int argc, char ** argv) QCoreApplication::setOrganizationDomain(QStringLiteral("qt-project.org")); QCoreApplication::setApplicationVersion(QLatin1String(QT_VERSION_STR)); - if (qEnvironmentVariableIsSet("QMLSCENE_CORE_PROFILE")) - options.coreProfile = true; - const QStringList arguments = QCoreApplication::arguments(); for (int i = 1, size = arguments.size(); i < size; ++i) { if (!arguments.at(i).startsWith(QLatin1Char('-'))) { @@ -512,8 +532,6 @@ int main(int argc, char ** argv) options.maximized = true; else if (lowerArgument == QLatin1String("--fullscreen")) options.fullscreen = true; - else if (lowerArgument == QLatin1String("--transparent")) - options.transparent = true; else if (lowerArgument == QLatin1String("--clip")) options.clip = true; else if (lowerArgument == QLatin1String("--no-version-detection")) @@ -526,10 +544,6 @@ int main(int argc, char ** argv) options.translationFile = QLatin1String(argv[++i]); else if (lowerArgument == QLatin1String("--resize-to-root")) options.resizeViewToRootItem = true; - else if (lowerArgument == QLatin1String("--multisample")) - options.multisample = true; - else if (lowerArgument == QLatin1String("--core-profile")) - options.coreProfile = true; else if (lowerArgument == QLatin1String("--verbose")) options.verbose = true; else if (lowerArgument == QLatin1String("-i") && i + 1 < size) @@ -623,18 +637,6 @@ int main(int argc, char ** argv) return -1; } - // Set default surface format before creating the window - QSurfaceFormat surfaceFormat; - if (options.multisample) - surfaceFormat.setSamples(16); - if (options.transparent) - surfaceFormat.setAlphaBufferSize(8); - if (options.coreProfile) { - surfaceFormat.setVersion(4, 1); - surfaceFormat.setProfile(QSurfaceFormat::CoreProfile); - } - QSurfaceFormat::setDefaultFormat(surfaceFormat); - QScopedPointer<QQuickWindow> window(qobject_cast<QQuickWindow *>(topLevel)); if (window) { engine.setIncubationController(window->incubationController()); |