From 8dd443034dda9505282b625b9895b15e1ac9a27d Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Thu, 31 May 2012 15:25:02 +0200 Subject: Add method to set size of QOpenGLPaintDevice. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iecc72c64dbb5f35ee41bdeb960bc759cd43b8bcb Reviewed-by: Samuel Rødal --- src/gui/opengl/qopenglpaintdevice.cpp | 19 +++++++++++++++++-- src/gui/opengl/qopenglpaintdevice.h | 2 ++ 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'src/gui/opengl') diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/gui/opengl/qopenglpaintdevice.cpp index 32da27a078..ff4b76db01 100644 --- a/src/gui/opengl/qopenglpaintdevice.cpp +++ b/src/gui/opengl/qopenglpaintdevice.cpp @@ -83,10 +83,20 @@ public: bool flipped; QPaintEngine *engine; - - void init(const QSize &size, QOpenGLContext *ctx); }; +/*! + Constructs a QOpenGLPaintDevice. + + The QOpenGLPaintDevice is only valid for the current context. + + \sa QOpenGLContext::currentContext() +*/ +QOpenGLPaintDevice::QOpenGLPaintDevice() + : d_ptr(new QOpenGLPaintDevicePrivate(QSize())) +{ +} + /*! Constructs a QOpenGLPaintDevice with the given \a size. @@ -166,6 +176,11 @@ QSize QOpenGLPaintDevice::size() const return d_ptr->size; } +void QOpenGLPaintDevice::setSize(const QSize &size) +{ + d_ptr->size = size; +} + int QOpenGLPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const { switch (metric) { diff --git a/src/gui/opengl/qopenglpaintdevice.h b/src/gui/opengl/qopenglpaintdevice.h index 7d4b901fe7..c1c3dfe9f8 100644 --- a/src/gui/opengl/qopenglpaintdevice.h +++ b/src/gui/opengl/qopenglpaintdevice.h @@ -71,6 +71,7 @@ class Q_GUI_EXPORT QOpenGLPaintDevice : public QPaintDevice { Q_DECLARE_PRIVATE(QOpenGLPaintDevice) public: + QOpenGLPaintDevice(); explicit QOpenGLPaintDevice(const QSize &size); QOpenGLPaintDevice(int width, int height); virtual ~QOpenGLPaintDevice(); @@ -80,6 +81,7 @@ public: QOpenGLContext *context() const; QSize size() const; + void setSize(const QSize &size); qreal dotsPerMeterX() const; qreal dotsPerMeterY() const; -- cgit v1.2.3