summaryrefslogtreecommitdiffstats
path: root/src/openglwidgets/qopenglwidget.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2021-01-05 13:22:44 +0100
committerLaszlo Agocs <laszlo.agocs@qt.io>2021-01-06 16:18:25 +0100
commit3ce5128d8062b7eca4925454610bd1df9db9d77a (patch)
tree6351af7a011aa0e78b7b5b2d9a5774ba4f88657f /src/openglwidgets/qopenglwidget.cpp
parentf0d1a50333f3945369077a48ba7f2bdf228276cc (diff)
Fix missing repaints with QOpenGLWidget in a QDockWidget
When AA_ShareOpenGLContexts is not set, docking or undocking will lead to changing the associated top-level window. This leads to changing the OpenGL context, and tearing down and then recreating all OpenGL resources (assuming a well written application). The problem is, there are no paint events after the Show, meaning the user code's paintGL is often not invoked, which leads to showing an empty QOpenGLWidget until something else triggers a paint event. To remedy this, send a paint event upon Show, which should be harmless enough, while fixing the case of docking/undocking. Pick-to: 6.0 5.15 Fixes: QTBUG-89812 Change-Id: I3c4560f8f069d86645a6314bf7ad1b4ee8e2c716 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/openglwidgets/qopenglwidget.cpp')
-rw-r--r--src/openglwidgets/qopenglwidget.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/openglwidgets/qopenglwidget.cpp b/src/openglwidgets/qopenglwidget.cpp
index 8dbb9180f4..a596416471 100644
--- a/src/openglwidgets/qopenglwidget.cpp
+++ b/src/openglwidgets/qopenglwidget.cpp
@@ -1381,8 +1381,13 @@ bool QOpenGLWidget::event(QEvent *e)
}
if (!d->initialized && !size().isEmpty() && window()->windowHandle()) {
d->initialize();
- if (d->initialized)
+ if (d->initialized) {
d->recreateFbo();
+ // QTBUG-89812: generate a paint event, like resize would do,
+ // otherwise a QOpenGLWidget in a QDockWidget may not show the
+ // content upon (un)docking.
+ d->sendPaintEvent(QRect(QPoint(0, 0), size()));
+ }
}
break;
case QEvent::ScreenChangeInternal: