path: root/src/gui/painting/qpaintdevice.qdoc
diff options
authorMorten Johan Sørvig <>2015-06-19 16:40:39 +0200
committerSimon Hausmann <>2015-07-30 04:04:01 +0000
commitdcd2debe625841ee8cba6d13a56cde7613c40358 (patch)
treed1d1e6c98d9cc5d81f29a389721acca6a9f7d150 /src/gui/painting/qpaintdevice.qdoc
parent0167ace5f0a7e5ad80ce95efc99c86235bcf8c0d (diff)
Enable non-integer device pixel ratio
Work around QPaintDevice::metric's int return type by adding a new metric that returns a scaled devicePixelRatio. Choose a scale factor that gives us more than enough range. The QPaintDevice::devicePixelRatio() convenience accessor is public API and can unfortunately not be changed to return a qreal. Add devicePixelRatioF() which returns the (unscaled) devicePixelRatio. Change all call sites of QPaintDevice::devicePixelRatio() to use QPainDevice::devicePixelRatioF(). Task-number: QTBUG-46615 Change-Id: I97ec4000fe379b7ff5e1624a871ae2512790aad9 Reviewed-by: Paul Olav Tvete <> Reviewed-by: Lars Knoll <>
Diffstat (limited to 'src/gui/painting/qpaintdevice.qdoc')
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gui/painting/qpaintdevice.qdoc b/src/gui/painting/qpaintdevice.qdoc
index 8db65af18e..a83acdd21a 100644
--- a/src/gui/painting/qpaintdevice.qdoc
+++ b/src/gui/painting/qpaintdevice.qdoc
@@ -286,3 +286,24 @@
Common values are 1 for normal-dpi displays and 2 for high-dpi
"retina" displays.
+ \fn qreal QPaintDevice::devicePixelRatioF() const
+ Returns the device pixel ratio for the device as a floating point number.
+ \since 5.6
+ \fn qreal QPaintDevice::devicePixelRatioFScale()
+ \internal
+ Returns the scaling factor used for \c PdmDevicePixelRatioScaled. Classes
+ that are not QPaintDevice subclasses are implementing metric(), and need to
+ access this constant. Since it's a qreal, it cannot be an enum, and an inline
+ function is more efficient than a static member variable.
+ \since 5.6