r23138 by jghali - #15778: Margins read from printer driver are wrong in landscape mode

scribus-commit scribus-commit at lists.scribus.net
Mon Aug 19 12:57:27 UTC 2019


Author: jghali
Date: Mon Aug 19 12:57:27 2019
New Revision: 23138

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23138
Log:
#15778: Margins read from printer driver are wrong in landscape mode

Modified:
    trunk/Scribus/scribus/util_printer.cpp

Modified: trunk/Scribus/scribus/util_printer.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23138&path=/trunk/Scribus/scribus/util_printer.cpp
==============================================================================
--- trunk/Scribus/scribus/util_printer.cpp	(original)
+++ trunk/Scribus/scribus/util_printer.cpp	Mon Aug 19 12:57:27 2019
@@ -90,7 +90,18 @@
 		return false;
 
 	QPrinter printer(pInfo, QPrinter::HighResolution);
-	margins = printer.pageLayout().margins(QPageLayout::Point);
+	margins = printer.pageLayout().margins();
+
+	// Unfortunately margin values are not updated when calling QPrinter or QPageLayout's setOrientation()
+	// so we have to adapt margin values according to orientation ourselves
+	if (pageSize.width() > pageSize.height())
+	{
+		double l = margins.left();
+		double r = margins.right();
+		double b = margins.bottom();
+		double t = margins.top();
+		margins = QMarginsF(b, l, t, r);
+	}
 	return true;
 }
 




More information about the scribus-commit mailing list