summaryrefslogtreecommitdiffstats
path: root/src/openglwidgets/qopenglwidget.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2023-08-24 13:18:03 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2023-08-28 21:14:28 +0200
commit80520c2f52aeaff4d01b2506d080770888ca8ec7 (patch)
tree26b296434de8e953e509a6b2aa19a181fbd144f5 /src/openglwidgets/qopenglwidget.cpp
parent41f032e358e704693834a98d37331d0d63b7aab9 (diff)
Enable QWidget::grab() with QRhiWidget in the widget tree
This involves reimplementing QWidgetPrivate::grabFramebuffer(). Widgets call this function whenever a texture-based widget is encountered. This implies however that we rename QRhiWidget's own, lightweight grab function, grab(), because it kind of shadows QWidget's grab(). Switch back to grabFramebuffer() which is what QQuickWidget and QOpenGLWidget both use. Supporting QWidget::grab() is particularly important when grabbing an ancestor of the QRhiWidget, because that has no alternative. Right now, due to not reimplementing the QWidgetPrivate function, the place of the QRhiWidget is left empty. In addition, grabFramebuffer() is now const. This is consistent with QQuickWidget, but not with QOpenGLWidget and QOpenGLWindow. Change-Id: I646bd920dab7ba50415dd7ee6b63a209f5673e8f Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/openglwidgets/qopenglwidget.cpp')
-rw-r--r--src/openglwidgets/qopenglwidget.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/openglwidgets/qopenglwidget.cpp b/src/openglwidgets/qopenglwidget.cpp
index 1abd210e42..b85e699fa4 100644
--- a/src/openglwidgets/qopenglwidget.cpp
+++ b/src/openglwidgets/qopenglwidget.cpp
@@ -972,6 +972,11 @@ void QOpenGLWidgetPrivate::render()
#endif
QOpenGLContextPrivate::get(ctx)->defaultFboRedirect = fbos[currentTargetBuffer]->handle();
+
+ f->glUseProgram(0);
+ f->glBindBuffer(GL_ARRAY_BUFFER, 0);
+ f->glEnable(GL_BLEND);
+
q->paintGL();
if (updateBehavior == QOpenGLWidget::NoPartialUpdate)
invalidateFboAfterPainting();