From 4080025fed9d43a78b578bcab67397712459d28c Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 9 Oct 2019 11:09:51 +0200 Subject: Set the screen on the QOpenGLContext to be the same as the window This ensures that the QOpenGLContext has the right screen information and can create a compatible context for use with QQuickWidget. Change-Id: I9d78ff2b616e5c1d1c11d1da438ce336a0f24953 Reviewed-by: Laszlo Agocs --- src/quickwidgets/qquickwidget.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index b63f7de9f1..55c095af8e 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -878,7 +878,9 @@ void QQuickWidgetPrivate::createContext() context = new QOpenGLContext; context->setFormat(offscreenWindow->requestedFormat()); - + const QWindow *win = q->window()->windowHandle(); + if (win && win->screen()) + context->setScreen(win->screen()); QOpenGLContext *shareContext = qt_gl_global_share_context(); if (!shareContext) shareContext = QWidgetPrivate::get(q->window())->shareContext(); -- cgit v1.2.3