Skip to content

Commit cd2f43e

Browse files
committed
Fix QPaintDevice metrics warnings for DevicePixelRatio metrics
Handle PdmDevicePixelRatio and PdmDevicePixelRatioScaled metrics in QwtNullPaintDevice.metric() to prevent 'Device has no metric information' warnings when falling back to super().metric(). This fixes warnings introduced by commit b86f058 which changed the default case from returning 0 to calling super().metric() for unhandled metrics.
1 parent 64f35d9 commit cd2f43e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

qwt/null_paintdevice.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,10 @@ def metric(self, deviceMetric):
272272
* 25.4
273273
/ self.metric(QPaintDevice.PdmDpiY)
274274
)
275+
elif deviceMetric == QPaintDevice.PdmDevicePixelRatio:
276+
value = 1
277+
elif deviceMetric == QPaintDevice.PdmDevicePixelRatioScaled:
278+
value = 1
275279
else:
276280
value = super(QwtNullPaintDevice, self).metric(deviceMetric)
277281
return value

0 commit comments

Comments
 (0)