summaryrefslogtreecommitdiffstats
path: root/src/printsupport/kernel
diff options
context:
space:
mode:
authorDavid Faure <david.faure@kdab.com>2014-12-29 16:37:55 +0100
committerMarc Mutz <marc.mutz@kdab.com>2015-01-19 10:39:55 +0100
commit7fc8c560e21e7175b1fe33c988f3f30e4b326efe (patch)
treeea24761578f6f68feb41d30a42bd6015c02c7f3f /src/printsupport/kernel
parent20480070a60469017770257b6c574c5707cda58b (diff)
Fix QPrinter::setPaperSize regression when using QPrinter::DevicePixel
The QPageSize-based refactoring led to casting DevicePixel to a QPageSize::Unit value of 6 (out of bounds). And then the switch in qt_nameForCustomSize would leave the string empty, leading to "QString::arg: Argument missing: , 672" warnings. Change-Id: I85e97174cc8ead9beccaaa3ded6edfad80f8e360 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Andy Shaw <andy.shaw@digia.com>
Diffstat (limited to 'src/printsupport/kernel')
-rw-r--r--src/printsupport/kernel/qprinter.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp
index 437a68e609..8ed2732c1e 100644
--- a/src/printsupport/kernel/qprinter.cpp
+++ b/src/printsupport/kernel/qprinter.cpp
@@ -1224,7 +1224,10 @@ void QPrinter::setPageSize(PageSize newPageSize)
void QPrinter::setPaperSize(const QSizeF &paperSize, QPrinter::Unit unit)
{
- setPageSize(QPageSize(paperSize, QPageSize::Unit(unit)));
+ if (unit == QPrinter::DevicePixel)
+ setPageSize(QPageSize(paperSize * qt_pixelMultiplier(resolution()), QPageSize::Point));
+ else
+ setPageSize(QPageSize(paperSize, QPageSize::Unit(unit)));
}
/*!