diff options
author | Andy Shaw <andy.shaw@digia.com> | 2014-01-31 13:11:34 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-06 17:27:37 +0100 |
commit | c8172953ed6d3776178b9a37c0773d648cfdd9f2 (patch) | |
tree | 3fc96f55bca320ac467bb94362d1acbd5f94e029 | |
parent | 845716d629cbb66d646cd61e8d3dc3acfe503889 (diff) | |
download | qtbase-c8172953ed6d3776178b9a37c0773d648cfdd9f2.tar.gz qtbase-c8172953ed6d3776178b9a37c0773d648cfdd9f2.tar.bz2 qtbase-c8172953ed6d3776178b9a37c0773d648cfdd9f2.zip |
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 <Friedemann.Kleint@digia.com>
-rw-r--r-- | src/printsupport/kernel/qprintengine_win.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
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<QPair<QSizeF, int> > paperSizes = printerPaperSizes(name); for (int i=0; i<paperSizes.size(); i++) { if ((uint)paperSizes.at(i).second == paperSize) { - paper_size = paperSizes.at(paperSize).first; + paper_size = paperSizes.at(i).first * multiplier; has_custom_paper_size = false; break; } |