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>bb10
parent
f0d1a50333
commit
3ce5128d80
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in New Issue