Add method to set size of QOpenGLPaintDevice.

Change-Id: Iecc72c64dbb5f35ee41bdeb960bc759cd43b8bcb
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
This commit is contained in:
Kim Motoyoshi Kalland 2012-05-31 15:25:02 +02:00 committed by Qt by Nokia
parent 5a447502b5
commit 8dd443034d
2 changed files with 19 additions and 2 deletions

View File

@ -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) {

View File

@ -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;