drop usage of QDesktopWidget

this drops support for Qt4
This commit is contained in:
KIU Shueng Chuan 2021-01-14 12:38:04 +08:00
parent 283e9eb563
commit cc2b811ed1
2 changed files with 2 additions and 10 deletions

View File

@ -45,11 +45,7 @@ class PrintExporter(Exporter):
#res = printer.resolution()
sr = self.getSourceRect()
#res = sr.width() * .4 / (self.params['width'] * 100 / 2.54)
try:
res = QtGui.QDesktopWidget().physicalDpiX()
except AttributeError:
# This is available since Qt 5
res = QtGui.QGuiApplication.primaryScreen().physicalDotsPerInchX()
res = QtGui.QGuiApplication.primaryScreen().physicalDotsPerInchX()
printer.setResolution(res)
rect = printer.pageRect()
center = rect.center()

View File

@ -195,11 +195,7 @@ def _generateItemSvg(item, nodes=None, root=None, options={}):
buf = QtCore.QBuffer(arr)
svg = QtSvg.QSvgGenerator()
svg.setOutputDevice(buf)
try:
dpi = QtGui.QDesktopWidget().logicalDpiX()
except AttributeError:
# This is available since Qt 5
dpi = QtGui.QGuiApplication.primaryScreen().logicalDotsPerInchX()
dpi = QtGui.QGuiApplication.primaryScreen().logicalDotsPerInchX()
svg.setResolution(dpi)
p = QtGui.QPainter()