79d60438e1
- backport a couple more upstream fixes - introduce -common noarch subpkg, should help multilib issues
69 lines
2.8 KiB
Diff
69 lines
2.8 KiB
Diff
From 7fc8c560e21e7175b1fe33c988f3f30e4b326efe Mon Sep 17 00:00:00 2001
|
|
From: David Faure <david.faure@kdab.com>
|
|
Date: Mon, 29 Dec 2014 16:37:55 +0100
|
|
Subject: [PATCH 004/248] 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>
|
|
---
|
|
src/printsupport/kernel/qprinter.cpp | 5 ++++-
|
|
tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp | 12 +++++++++++-
|
|
2 files changed, 15 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp
|
|
index 437a68e..8ed2732 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)));
|
|
}
|
|
|
|
/*!
|
|
diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
|
|
index 78aa0af..62bd982 100644
|
|
--- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
|
|
+++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
|
|
@@ -526,7 +526,7 @@ void tst_QPrinter::testCustomPageSizes()
|
|
{
|
|
QPrinter p;
|
|
|
|
- QSizeF customSize(8.5, 11.0);
|
|
+ QSizeF customSize(7.0, 11.0);
|
|
p.setPaperSize(customSize, QPrinter::Inch);
|
|
|
|
QSizeF paperSize = p.paperSize(QPrinter::Inch);
|
|
@@ -538,6 +538,16 @@ void tst_QPrinter::testCustomPageSizes()
|
|
paperSize = p.paperSize(QPrinter::Inch);
|
|
QCOMPARE(paperSize.width(), customSize.width());
|
|
QCOMPARE(paperSize.height(), customSize.height());
|
|
+
|
|
+ const QSizeF sizeInPixels = p.paperSize(QPrinter::DevicePixel);
|
|
+ QPrinter p3;
|
|
+ p3.setPaperSize(sizeInPixels, QPrinter::DevicePixel);
|
|
+ paperSize = p3.paperSize(QPrinter::Inch);
|
|
+ QCOMPARE(paperSize.width(), customSize.width());
|
|
+ QCOMPARE(paperSize.height(), customSize.height());
|
|
+ QPageSize pageSize = p3.pageLayout().pageSize();
|
|
+ QCOMPARE(pageSize.key(), QString("Custom.504x792"));
|
|
+ QCOMPARE(pageSize.name(), QString("Custom (504pt x 792pt)"));
|
|
}
|
|
|
|
void tst_QPrinter::customPaperSizeAndMargins_data()
|
|
--
|
|
2.3.7
|
|
|