diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-04-02 01:01:02 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-04-02 01:01:03 +0200 |
commit | a6a8832078caec920e02d68c2ce84b5587f6f0c0 (patch) | |
tree | 688a0799e231815895129a1570134c3e216d04f4 /tools/qmlscene/main.cpp | |
parent | d9aad59d4144f5bf725893b5a008fe5c52ff5634 (diff) | |
parent | 14109aaccc37df53a0c4b591dddd68b41ec20ec3 (diff) |
Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I1dd04210f10895c509b5c637fc5e2dcf66e3bb91
Diffstat (limited to 'tools/qmlscene/main.cpp')
-rw-r--r-- | tools/qmlscene/main.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp index 465bcb53d4..c6c6ed1c4a 100644 --- a/tools/qmlscene/main.cpp +++ b/tools/qmlscene/main.cpp @@ -522,7 +522,8 @@ int main(int argc, char ** argv) options.resizeViewToRootItem = true; else if (lowerArgument == QLatin1String("--multisample")) options.multisample = true; - else if (lowerArgument == QLatin1String("--core-profile")) + else if (lowerArgument == QLatin1String("--core-profile") + || qEnvironmentVariableIsSet("QMLSCENE_CORE_PROFILE")) options.coreProfile = true; else if (lowerArgument == QLatin1String("--verbose")) options.verbose = true; @@ -612,6 +613,19 @@ int main(int argc, char ** argv) fprintf(stderr, "%s\n", qPrintable(component->errorString())); 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()); @@ -635,19 +649,11 @@ int main(int argc, char ** argv) if (options.verbose) new DiagnosticGlContextCreationListener(window.data()); #endif - QSurfaceFormat surfaceFormat = window->requestedFormat(); - if (options.multisample) - surfaceFormat.setSamples(16); if (options.transparent) { - surfaceFormat.setAlphaBufferSize(8); window->setClearBeforeRendering(true); window->setColor(QColor(Qt::transparent)); window->setFlags(Qt::FramelessWindowHint); } - if (options.coreProfile) { - surfaceFormat.setVersion(4, 1); - surfaceFormat.setProfile(QSurfaceFormat::CoreProfile); - } window->setFormat(surfaceFormat); if (window->flags() == Qt::Window) // Fix window flags unless set by QML. |