diff options
author | Albert Astals Cid <albert.astals.cid@kdab.com> | 2018-01-12 15:02:43 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2018-01-17 21:36:41 +0000 |
commit | f56f47bc64aeb7a2eea28c3734b57197fd4faa28 (patch) | |
tree | 72a65df9950f5c86807898a303efe2a8fdbb6089 /src/printsupport/dialogs/qpagesetupdialog_unix.cpp | |
parent | ef60435d2f5bc1f3962388a3b51941015893a4d0 (diff) |
Unix: Fix default printer page size margins
Regressed with ff67dedaaff2dc68571ca9c8c6c6eeaaf084eae4
Before ff67dedaaff2dc68571ca9c8c6c6eeaaf084eae4 the print dialog
would not let you select less margin than the minimum printer
supported margin, this brings back the old behavior
Change-Id: I22f4e8ebf8ffa7c1653d61b7073a9ee582cf453b
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'src/printsupport/dialogs/qpagesetupdialog_unix.cpp')
-rw-r--r-- | src/printsupport/dialogs/qpagesetupdialog_unix.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp index 20634085f8..13c91742f2 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp +++ b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp @@ -59,6 +59,8 @@ QT_BEGIN_NAMESPACE +extern QMarginsF qt_convertMargins(const QMarginsF &margins, QPageLayout::Unit fromUnits, QPageLayout::Unit toUnits); + // Disabled until we have support for papersources on unix // #define PSD_ENABLE_PAPERSOURCE @@ -390,8 +392,11 @@ void QPageSetupWidget::setPrinter(QPrinter *printer, QPrintDevice *printDevice, // Initialize the layout to the current QPrinter layout m_pageLayout = m_printer->pageLayout(); - if (printDevice) - m_pageLayout.setPageSize(printDevice->defaultPageSize()); + if (printDevice) { + const QPageSize pageSize = printDevice->defaultPageSize(); + const QMarginsF printable = printDevice->printableMargins(pageSize, m_pageLayout.orientation(), m_printer->resolution()); + m_pageLayout.setPageSize(pageSize, qt_convertMargins(printable, QPageLayout::Point, m_pageLayout.units())); + } // Assume if margins are Points then is by default, so set to locale default units if (m_pageLayout.units() == QPageLayout::Point) { |