diff options
Diffstat (limited to 'src/widgets/kernel/qopenglwidget.cpp')
-rw-r--r-- | src/widgets/kernel/qopenglwidget.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp index 24e0c46032..b6b04795d5 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -453,6 +453,19 @@ QT_BEGIN_NAMESPACE each frame. To restore the preserved behavior, call setUpdateBehavior() with \c PartialUpdate. + \note Displaying a QOpenGLWidget requires an alpha channel in the associated + top-level window's backing store due to the way composition with other + QWidget-based content works. If there is no alpha channel, the content + rendered by the QOpenGLWidget will not be visible. This can become + particularly relevant on Linux/X11 in remote display setups (such as, with + Xvnc), when using a color depth lower than 24. For example, a color depth of + 16 will typically map to using a backing store image with the format + QImage::Format_RGB16 (RGB565), leaving no room for an alpha + channel. Therefore, if experiencing problems with getting the contents of a + QOpenGLWidget composited correctly with other the widgets in the window, make + sure the server (such as, vncserver) is configured with a 24 or 32 bit depth + instead of 16. + \section1 Alternatives Adding a QOpenGLWidget into a window turns on OpenGL-based @@ -1452,8 +1465,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: |