summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/kernel/qopenglcontext.cpp2
-rw-r--r--src/opengl/qgl_qpa.cpp13
2 files changed, 10 insertions, 5 deletions
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index 483baf0f09..c93752c3d7 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -759,7 +759,7 @@ bool QOpenGLContext::makeCurrent(QSurface *surface)
return false;
if (surface->surfaceType() != QSurface::OpenGLSurface) {
- qWarning() << "QOpenGLContext::makeCurrent() called with non-opengl surface";
+ qWarning() << "QOpenGLContext::makeCurrent() called with non-opengl surface" << surface;
return false;
}
diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp
index 0a24654624..f3388ee5ef 100644
--- a/src/opengl/qgl_qpa.cpp
+++ b/src/opengl/qgl_qpa.cpp
@@ -146,10 +146,15 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
if (widget->testAttribute(Qt::WA_TranslucentBackground))
winFormat.setAlphaBufferSize(qMax(winFormat.alphaBufferSize(), 8));
- if (!widget->windowHandle()->handle()) {
- widget->windowHandle()->setSurfaceType(QWindow::OpenGLSurface);
- widget->windowHandle()->setFormat(winFormat);
- widget->winId();//make window
+ QWindow *window = widget->windowHandle();
+ if (!window->handle()
+ || window->surfaceType() != QWindow::OpenGLSurface
+ || window->requestedFormat() != winFormat)
+ {
+ window->setSurfaceType(QWindow::OpenGLSurface);
+ window->setFormat(winFormat);
+ window->destroy();
+ window->create();
}
if (d->ownContext)