eric6/Tools/UIPreviewer.py

changeset 8298
83ddb87b3bc1
parent 8243
cc717c2ae956
diff -r c1f9e30c6219 -r 83ddb87b3bc1 eric6/Tools/UIPreviewer.py
--- a/eric6/Tools/UIPreviewer.py	Sat May 08 18:38:57 2021 +0200
+++ b/eric6/Tools/UIPreviewer.py	Sat May 08 19:47:48 2021 +0200
@@ -581,8 +581,14 @@
         @param printer reference to the printer object (QPrinter)
         """
         p = QPainter(printer)
-        marginX = (printer.pageRect().x() - printer.paperRect().x()) // 2
-        marginY = (printer.pageRect().y() - printer.paperRect().y()) // 2
+        marginX = (
+            printer.pageLayout().paintRectPixels(printer.resolution()).x() -
+            printer.pageLayout().fullRectPixels(printer.resolution()).x()
+        ) // 2
+        marginY = (
+            printer.pageLayout().paintRectPixels(printer.resolution()).y() -
+            printer.pageLayout().fullRectPixels(printer.resolution()).y()
+        ) // 2
 
         # double the margin on bottom of page
         if printer.orientation() == QPrinter.Orientation.Portrait:

eric ide

mercurial