summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEirik Aavitsland <[email protected]>2023-11-09 11:20:42 +0100
committerQt Cherry-pick Bot <[email protected]>2023-11-09 19:49:00 +0000
commit4d691cfc8ad2ddcdb72209cc19752ed5c8bbb577 (patch)
tree6f00448d7a8c325f385a8b5c503eb81c71ebad7f
parent774d80a7d5db9adf648ce3a02bdef763d14e8794 (diff)
QPrinter: allow any margins when setting a fullpage QPageLayout
By default, QPrinter::setPageLayout correctly rejects a layout that specifies margins outside the printable area. However, when the layout specifies fullpage mode, that check should be skipped, since then one should be allowed to target the unprintable area, by definition. Fixes: QTBUG-118580 Pick-to: 6.5 Change-Id: I8bd93d11aefee0344725ac51c2490d029657f483 Reviewed-by: Laszlo Agocs <[email protected]> (cherry picked from commit 2ac50bb0f539b1ee62503ff136063c693d4662e9) Reviewed-by: Qt Cherry-pick Bot <[email protected]>
-rw-r--r--src/printsupport/kernel/qplatformprintdevice.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/printsupport/kernel/qplatformprintdevice.cpp b/src/printsupport/kernel/qplatformprintdevice.cpp
index 0ea0242edd4..a2ee51f8872 100644
--- a/src/printsupport/kernel/qplatformprintdevice.cpp
+++ b/src/printsupport/kernel/qplatformprintdevice.cpp
@@ -75,6 +75,10 @@ bool QPlatformPrintDevice::isValidPageLayout(const QPageLayout &layout, int reso
if (!supportedPageSize(layout.pageSize()).isValid())
return false;
+ // In fullpage mode, margins outside the printable area are valid
+ if (layout.mode() == QPageLayout::FullPageMode)
+ return true;
+
// Check the margins are valid
QMarginsF pointMargins = layout.margins(QPageLayout::Point);
QMarginsF printMargins = printableMargins(layout.pageSize(), layout.orientation(), resolution);