Windows: Use the ptPaperSize information to set the paper size

In some cases the DEVMODE structure is not updated with the selected
paper size, whereas the ptPaperSize structure is always set to the right
paper size. Therefore we set the page size on the printer to this after
the page dialog is shown.

Change-Id: Ieafd486232aca6e930f73a8131b7196ddecea305
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
bb10
Andy Shaw 2018-12-14 09:14:19 +01:00
parent 7fc427ba23
commit 71b2de1f1d
1 changed files with 2 additions and 0 deletions

View File

@ -134,6 +134,8 @@ int QPageSetupDialog::exec()
QDialog::setVisible(false);
if (result) {
engine->setGlobalDevMode(psd.hDevNames, psd.hDevMode);
d->printer->setPageSize(QPageSize(QSizeF(psd.ptPaperSize.x / multiplier, psd.ptPaperSize.y / multiplier),
layout.units() == QPageLayout::Inch ? QPageSize::Inch : QPageSize::Millimeter));
const QMarginsF margins(psd.rtMargin.left, psd.rtMargin.top, psd.rtMargin.right, psd.rtMargin.bottom);
d->printer->setPageMargins(margins / multiplier, layout.units());