diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-10-15 06:26:19 (GMT) |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-10-15 06:49:48 (GMT) |
commit | 8b568a5afd24ecb343b7508bf6b27b27af59b226 (patch) | |
tree | e792a660a9dac1c514ef31b29080e84907671871 /src/plugins/graphicssystems | |
parent | 1f73b205ec57be6327f62ef39099358425a7f0a8 (diff) | |
download | Qt-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/plugins/graphicssystems')
-rw-r--r-- | src/plugins/graphicssystems/shivavg/shivavgwindowsurface.cpp | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/src/plugins/graphicssystems/shivavg/shivavgwindowsurface.cpp b/src/plugins/graphicssystems/shivavg/shivavgwindowsurface.cpp index df623ba..955aa55 100644 --- a/src/plugins/graphicssystems/shivavg/shivavgwindowsurface.cpp +++ b/src/plugins/graphicssystems/shivavg/shivavgwindowsurface.cpp @@ -350,21 +350,9 @@ QPaintEngine *ShivaVGWindowSurface::paintEngine() const return d_ptr->engine; } -// We need to get access to QWidget::metric() from ShivaVGWindowSurface::metric, -// but it is not a friend of QWidget. To get around this, we create a -// fake QX11PaintEngine class, which is a friend. -class QX11PaintEngine -{ -public: - static int metric(const QWidget *widget, QPaintDevice::PaintDeviceMetric met) - { - return widget->metric(met); - } -}; - int ShivaVGWindowSurface::metric(PaintDeviceMetric met) const { - return QX11PaintEngine::metric(window(), met); + return qt_paint_device_metric(window(), met); } QT_END_NAMESPACE |