summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-04-02 01:01:02 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-04-02 01:01:03 +0200
commita6a8832078caec920e02d68c2ce84b5587f6f0c0 (patch)
tree688a0799e231815895129a1570134c3e216d04f4 /tools
parentd9aad59d4144f5bf725893b5a008fe5c52ff5634 (diff)
parent14109aaccc37df53a0c4b591dddd68b41ec20ec3 (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
Diffstat (limited to 'tools')
-rw-r--r--tools/qmlscene/main.cpp24
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.