* Fri Sep 09 2016 Kevin Kofler <Kevin@tigcc.ticalc.org> - 5.7.0-7 - apply the correct page margins from the QPageLayout to Chromium printingepel9
parent
209618155b
commit
bda84512e3
@ -0,0 +1,40 @@
|
||||
From e4305a681eb3b8e21f028627df8bed10d7071676 Mon Sep 17 00:00:00 2001
|
||||
From: Kevin Kofler <kevin.kofler@chello.at>
|
||||
Date: Fri, 9 Sep 2016 03:20:17 +0200
|
||||
Subject: [PATCH] Apply the correct page margins from the QPageLayout to
|
||||
Chromium printing
|
||||
|
||||
If one passes a QPageLayout to printToPDF, surely one expects the margin
|
||||
settings contained in it to actually get applied.
|
||||
|
||||
This is a partial backport of the much larger 5.8 commit
|
||||
af2535018b1553e351198f3d9c21538de1c328a1 (by Michael Bruning), limited
|
||||
to only the margin fix.
|
||||
---
|
||||
src/core/print_view_manager_qt.cpp | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/src/core/print_view_manager_qt.cpp b/src/core/print_view_manager_qt.cpp
|
||||
index 4cb0e06..0db1df4 100644
|
||||
--- a/src/core/print_view_manager_qt.cpp
|
||||
+++ b/src/core/print_view_manager_qt.cpp
|
||||
@@ -115,6 +115,16 @@ static void applyQPageLayoutSettingsToDictionary(const QPageLayout& pageLayout,
|
||||
sizeDict->SetInteger(printing::kSettingMediaSizeHeightMicrons, pageSizeInMilimeter.height() * kMicronsToMillimeter);
|
||||
print_settings.Set(printing::kSettingMediaSize, std::move(sizeDict));
|
||||
|
||||
+ // Apply page margins
|
||||
+ QMargins pageMarginsInPoints = pageLayout.marginsPoints();
|
||||
+ scoped_ptr<base::DictionaryValue> marginsDict(new base::DictionaryValue);
|
||||
+ marginsDict->SetInteger(printing::kSettingMarginTop, pageMarginsInPoints.top());
|
||||
+ marginsDict->SetInteger(printing::kSettingMarginBottom, pageMarginsInPoints.bottom());
|
||||
+ marginsDict->SetInteger(printing::kSettingMarginLeft, pageMarginsInPoints.left());
|
||||
+ marginsDict->SetInteger(printing::kSettingMarginRight, pageMarginsInPoints.right());
|
||||
+ printSettings.Set(printing::kSettingMarginsCustom, std::move(marginsDict));
|
||||
+ printSettings.SetInteger(printing::kSettingMarginsType, printing::CUSTOM_MARGINS);
|
||||
+
|
||||
print_settings.SetBoolean(printing::kSettingLandscape, pageLayout.orientation() == QPageLayout::Landscape);
|
||||
|
||||
// The following are standard settings that Chromium expects to be set.
|
||||
--
|
||||
2.1.0
|
||||
|
Loading…
Reference in new issue