Skip to content

Commit

Permalink
QPrinter: allow any margins when setting a fullpage QPageLayout
Browse files Browse the repository at this point in the history
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.6 6.5
Change-Id: I8bd93d11aefee0344725ac51c2490d029657f483
Reviewed-by: Laszlo Agocs <[email protected]>
  • Loading branch information
aavit committed Nov 9, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 52eae99 commit 2ac50bb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/printsupport/kernel/qplatformprintdevice.cpp
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit 2ac50bb

Please sign in to comment.