summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpaintdevice.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/painting/qpaintdevice.cpp')
-rw-r--r--src/gui/painting/qpaintdevice.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gui/painting/qpaintdevice.cpp b/src/gui/painting/qpaintdevice.cpp
index bbf8e8f170..27d4bbcfd7 100644
--- a/src/gui/painting/qpaintdevice.cpp
+++ b/src/gui/painting/qpaintdevice.cpp
@@ -41,6 +41,8 @@ QPaintDevice::QPaintDevice() Q_DECL_NOEXCEPT
painters = 0;
}
+qreal QPaintDevice::devicePixelRatioFScale = 10000000.0;
+
QPaintDevice::~QPaintDevice()
{
if (paintingActive())
@@ -79,7 +81,13 @@ Q_GUI_EXPORT int qt_paint_device_metric(const QPaintDevice *device, QPaintDevice
int QPaintDevice::metric(PaintDeviceMetric m) const
{
+ // Fallback: A subclass has not implemented PdmDevicePixelRatioScaled but might
+ // have implemented PdmDevicePixelRatio.
+ if (m == PdmDevicePixelRatioScaled)
+ return this->metric(PdmDevicePixelRatio) * devicePixelRatioFScale;
+
qWarning("QPaintDevice::metrics: Device has no metric information");
+
if (m == PdmDpiX) {
return 72;
} else if (m == PdmDpiY) {
@@ -95,4 +103,5 @@ int QPaintDevice::metric(PaintDeviceMetric m) const
}
}
+
QT_END_NAMESPACE