From ebc835c2aa02f0b3dc6e4806bde03f33513d3556 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 14 Oct 2014 12:07:41 +0200 Subject: Fix QOpenGLWidget on Cocoa when used as viewport MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Having a QOpenGLWidget as a graphics view viewport was not functioning on OS X: it was showing incomplete content due to accessing the texture attached to the framebuffer object before the rendering is complete. On the normal path, when rendering is done via paintGL(), the flush was there. When used as a viewport however, this path is not used. The missing flush is now added for the other case too. For performance reasons, we will not flush on every paint engine end(). Instead, the flush is deferred until composition starts. QGLWidget also featured a weird on-by-default autoFillBackground concept. To maintain compatibility with apps that used QGLWidget as the viewport for QGraphicsView, we will now do the same for QOpenGLWidget, but only when it is used as a viewport. For regular QOpenGLWidgets autoFillBackground defaults to false, like for any other widget. The docs are extended with a small section about differences between QGLWidget and QOpenGLWidget. Task-number: QTBUG-41046 Change-Id: I42c2033fdd2ef5815783fd640fe11373761061e0 Reviewed-by: Jørgen Lind --- src/gui/opengl/qopenglpaintdevice.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gui/opengl/qopenglpaintdevice.h') diff --git a/src/gui/opengl/qopenglpaintdevice.h b/src/gui/opengl/qopenglpaintdevice.h index e1be9b525d..d88992d6db 100644 --- a/src/gui/opengl/qopenglpaintdevice.h +++ b/src/gui/opengl/qopenglpaintdevice.h @@ -73,7 +73,9 @@ public: void setPaintFlipped(bool flipped); bool paintFlipped() const; + virtual void beginPaint(); virtual void ensureActiveTarget(); + virtual void endPaint(); protected: int metric(QPaintDevice::PaintDeviceMetric metric) const; -- cgit v1.2.3 From 6d1c4c8862161fd4aaffe307c7267ceeb408d8d8 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 14 Oct 2014 12:07:41 +0200 Subject: Avoid breaking BC with new virtuals in QOpenGLPaintDevice Task-number: QTBUG-41046 Change-Id: Iab628d2d6811d528e2cc513b6f8a74baa628541d Reviewed-by: Gunnar Sletta --- src/gui/opengl/qopenglpaintdevice.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/gui/opengl/qopenglpaintdevice.h') diff --git a/src/gui/opengl/qopenglpaintdevice.h b/src/gui/opengl/qopenglpaintdevice.h index d88992d6db..dda3bfe43f 100644 --- a/src/gui/opengl/qopenglpaintdevice.h +++ b/src/gui/opengl/qopenglpaintdevice.h @@ -44,7 +44,6 @@ QT_BEGIN_NAMESPACE - class QOpenGLPaintDevicePrivate; class Q_GUI_EXPORT QOpenGLPaintDevice : public QPaintDevice @@ -54,6 +53,7 @@ public: QOpenGLPaintDevice(); explicit QOpenGLPaintDevice(const QSize &size); QOpenGLPaintDevice(int width, int height); + QOpenGLPaintDevice(QOpenGLPaintDevicePrivate *dd); virtual ~QOpenGLPaintDevice(); int devType() const { return QInternal::OpenGL; } @@ -73,9 +73,7 @@ public: void setPaintFlipped(bool flipped); bool paintFlipped() const; - virtual void beginPaint(); virtual void ensureActiveTarget(); - virtual void endPaint(); protected: int metric(QPaintDevice::PaintDeviceMetric metric) const; -- cgit v1.2.3