Skip to content

Commit

Permalink
Fixed QPrinter.setPaperSize deprecation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreRaybaut committed Oct 16, 2023
1 parent d921204 commit fc674e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion qwt/plot_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
QColor,
QImage,
QImageWriter,
QPageSize,
QPaintDevice,
QPainter,
QPainterPath,
Expand Down Expand Up @@ -246,7 +247,7 @@ def renderDocument(
printer.setOutputFormat(QPrinter.PostScriptFormat)
printer.setColorMode(QPrinter.Color)
printer.setFullPage(True)
printer.setPaperSize(sizeMM, QPrinter.Millimeter)
printer.setPageSize(QPageSize(sizeMM, QPageSize.Millimeter))
printer.setDocName(title)
printer.setOutputFileName(filename)
printer.setResolution(resolution)
Expand Down Expand Up @@ -725,3 +726,4 @@ def exportTo(self, plot, documentname, sizeMM=None, resolution=85):
return False
self.renderDocument(plot, filename, sizeMM, resolution)
return True
return True
5 changes: 4 additions & 1 deletion qwt/tests/test_bodedemo.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,10 @@ def print_(self, unattended=False):

printer.setCreator("Bode example")
printer.setPageOrientation(QPageLayout.Landscape)
printer.setColorMode(QPrinter.Color)
try:
printer.setColorMode(QPrinter.Color)
except AttributeError:
pass

docName = str(self.plot.title().text())
if not docName:
Expand Down

0 comments on commit fc674e4

Please sign in to comment.