summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qopenglwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/kernel/qopenglwidget.cpp')
-rw-r--r--src/widgets/kernel/qopenglwidget.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp
index 4d45782170..e401444e6e 100644
--- a/src/widgets/kernel/qopenglwidget.cpp
+++ b/src/widgets/kernel/qopenglwidget.cpp
@@ -537,6 +537,7 @@ public:
w(widget) { }
void beginPaint() Q_DECL_OVERRIDE;
+ void endPaint() Q_DECL_OVERRIDE;
QOpenGLWidget *w;
};
@@ -634,6 +635,16 @@ void QOpenGLWidgetPaintDevicePrivate::beginPaint()
}
}
+void QOpenGLWidgetPaintDevicePrivate::endPaint()
+{
+ QOpenGLWidgetPrivate *wd = static_cast<QOpenGLWidgetPrivate *>(QWidgetPrivate::get(w));
+ if (!wd->initialized)
+ return;
+
+ if (!wd->inPaintGL)
+ QOpenGLContextPrivate::get(wd->context)->defaultFboRedirect = 0;
+}
+
void QOpenGLWidgetPaintDevice::ensureActiveTarget()
{
QOpenGLWidgetPaintDevicePrivate *d = static_cast<QOpenGLWidgetPaintDevicePrivate *>(d_ptr.data());
@@ -646,6 +657,9 @@ void QOpenGLWidgetPaintDevice::ensureActiveTarget()
else
wd->fbo->bind();
+ if (!wd->inPaintGL)
+ QOpenGLContextPrivate::get(wd->context)->defaultFboRedirect = wd->fbo->handle();
+
// When used as a viewport, drawing is done via opening a QPainter on the widget
// without going through paintEvent(). We will have to make sure a glFlush() is done
// before the texture is accessed also in this case.