fix svg.setResolution(int) deprecation warning

triggered only for PyQt binding, Python 3.8, 3.9

there is a mismatch in API:
- QScreen.logicalDotsPerInchX() -> float
- QSvgGenerator.setResolution(int)
This commit is contained in:
KIU Shueng Chuan 2021-02-06 17:43:12 +08:00
parent 321b5e627a
commit 310afebe56

View File

@ -199,7 +199,7 @@ def _generateItemSvg(item, nodes=None, root=None, options={}):
svg = QtSvg.QSvgGenerator()
svg.setOutputDevice(buf)
dpi = QtGui.QGuiApplication.primaryScreen().logicalDotsPerInchX()
svg.setResolution(dpi)
svg.setResolution(int(dpi))
p = QtGui.QPainter()
p.begin(svg)