summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-10-15 06:26:19 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-10-15 06:49:48 (GMT)
commit8b568a5afd24ecb343b7508bf6b27b27af59b226 (patch)
treee792a660a9dac1c514ef31b29080e84907671871 /src/opengl
parent1f73b205ec57be6327f62ef39099358425a7f0a8 (diff)
downloadQt-8b568a5afd24ecb343b7508bf6b27b27af59b226.zip
Qt-8b568a5afd24ecb343b7508bf6b27b27af59b226.tar.gz
Qt-8b568a5afd24ecb343b7508bf6b27b27af59b226.tar.bz2
qt_paint_device_metric() for fetching metrics
Custom window surfaces, graphics systems, and Qt/Embedded screen drivers often need to access QPaintDevice::metric(), but it is protected. Hence the growing number of friends in QWidget and QImage. The qt_paint_device_metric() function provides a more future-proof approach that doesn't require lots of friends. Reviewed-by: Gunnar
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qglpaintdevice_qws.cpp9
-rw-r--r--src/opengl/qwindowsurface_gl.cpp2
2 files changed, 2 insertions, 9 deletions
diff --git a/src/opengl/qglpaintdevice_qws.cpp b/src/opengl/qglpaintdevice_qws.cpp
index 8c2f27d..1512278 100644
--- a/src/opengl/qglpaintdevice_qws.cpp
+++ b/src/opengl/qglpaintdevice_qws.cpp
@@ -52,13 +52,6 @@ public:
QWidget *widget;
};
-class QMetricAccessor : public QWidget {
-public:
- int metric(PaintDeviceMetric m) {
- return QWidget::metric(m);
- }
-};
-
QWSGLPaintDevice::QWSGLPaintDevice(QWidget *widget) :
d_ptr(new QWSGLPaintDevicePrivate)
{
@@ -80,7 +73,7 @@ int QWSGLPaintDevice::metric(PaintDeviceMetric m) const
Q_D(const QWSGLPaintDevice);
Q_ASSERT(d->widget);
- return ((QMetricAccessor *) d->widget)->metric(m);
+ return qt_paint_device_metric(d->widget, m);
}
QWSGLWindowSurface* QWSGLPaintDevice::windowSurface() const
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index b341243..df84a76 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -280,7 +280,7 @@ QGLContext* QGLWindowSurfaceGLPaintDevice::context() const
int QGLWindowSurfaceGLPaintDevice::metric(PaintDeviceMetric m) const
{
- return d->q_ptr->window()->metric(m);
+ return qt_paint_device_metric(d->q_ptr->window(), m);
}
QPaintEngine *QGLWindowSurfaceGLPaintDevice::paintEngine() const