From c8172953ed6d3776178b9a37c0773d648cfdd9f2 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 31 Jan 2014 13:11:34 +0100 Subject: Fix printing with a custom paper specified. If DMPAPER_USER is set from the print dialog then it is expected that the specific member variables to get the custom width and length are used. The size returned by querying the DC_PAPERSIZE is some random default and is not the one actually requested by the user. Also ensure that when it is a custom paper size from the driver itself that we store the right paper size. Change-Id: I760b8429ca1b01f5e303f2111b8d7ca1795c8ab8 Reviewed-by: Friedemann Kleint --- src/printsupport/kernel/qprintengine_win.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/printsupport') diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp index fc462e9a0a..6fa75338aa 100644 --- a/src/printsupport/kernel/qprintengine_win.cpp +++ b/src/printsupport/kernel/qprintengine_win.cpp @@ -1959,13 +1959,17 @@ static void draw_text_item_win(const QPointF &pos, const QTextItemInt &ti, HDC h void QWin32PrintEnginePrivate::updateCustomPaperSize() { const uint paperSize = devMode->dmPaperSize; + const double multiplier = qt_multiplierForUnit(QPrinter::Millimeter, resolution); has_custom_paper_size = false; - if (paperSize > 0 && mapDevmodePaperSize(paperSize) == QPrinter::Custom) { + if (paperSize == DMPAPER_USER) { + has_custom_paper_size = true; + paper_size = QSizeF((devMode->dmPaperWidth / 10.0) * multiplier, (devMode->dmPaperLength / 10.0) * multiplier); + } else if (mapDevmodePaperSize(paperSize) == QPrinter::Custom) { has_custom_paper_size = true; const QList > paperSizes = printerPaperSizes(name); for (int i=0; i