diff options
author | Tomi Korpipaa <tomi.korpipaa@qt.io> | 2019-03-29 08:55:11 +0200 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@qt.io> | 2019-03-29 08:53:54 +0000 |
commit | 0df69773376a0489288a938d485c75c49cc4de09 (patch) | |
tree | 7c245b8c90e0f0cb1e50ec24f23dcff76bdaf57f /tools | |
parent | aa51b3bf4ea854ffe7b39403289689daa428b221 (diff) |
Fix surface format bug for macOS
Task-number: QT3DS-3238
Change-Id: Ie3a675ef32251481abaa460bb89bc1c4381573ea
Reviewed-by: Pasi Keränen <pasi.keranen@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qmlscene/main.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp index c1399c38e5..8b1a679183 100644 --- a/tools/qmlscene/main.cpp +++ b/tools/qmlscene/main.cpp @@ -612,6 +612,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 +648,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. |