summaryrefslogtreecommitdiffstats
path: root/src/printsupport
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@digia.com>2014-01-31 13:11:34 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-06 17:27:37 +0100
commitc8172953ed6d3776178b9a37c0773d648cfdd9f2 (patch)
tree3fc96f55bca320ac467bb94362d1acbd5f94e029 /src/printsupport
parent845716d629cbb66d646cd61e8d3dc3acfe503889 (diff)
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>
Diffstat (limited to 'src/printsupport')
-rw-r--r--src/printsupport/kernel/qprintengine_win.cpp8
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;
}