Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.8.4, 5.1.1
-
None
-
Windows, Linux
-
Manual test code: 2e8ad02b7d10c100dcd9d559b019c474fa4b8a29 (5.2 RC), Fix 3396ba5612c1047d1b21a90c4996dff848c00114
Description
The code below can be used to reproduce the issue:
#include <QApplication> #include <QPrinter> #include <QPrintDialog> #include <QPainter> #include <QDebug> int main(int argc, char *argv[]) { QApplication a(argc, argv); QPrinter p; p.setPaperSize(QSizeF(5, 5), QPrinter::Inch); QPainter pp(&p); pp.drawRect(p.pageRect()); QPrintDialog d(&p); qDebug() << p.printerName() << p.paperSize() << p.paperSize(QPrinter::Inch) << p.paperRect() << p.pageRect(); if (d.exec()) { qDebug() << p.printerName() << p.paperSize() << p.paperSize(QPrinter::Inch) << p.paperRect() << p.pageRect(); } return a.exec(); }
Expected result:
The printed paperSize should be custom
Actual result:
The paperSize is set to A4
The issue is present on Linux and Windows, but the outcome is different.
on Linux:
With the code above (printed to a file), the created pdf has the right size on Qt 4.8, but the dialog shows incorrect width and height. However, on Qt 5.x the created pdf has the width and height shown in the printdialog.
on Windows:
Both Qt 4.8 and Qt 5 the size is incorrect
The patch attached should fix the issue on Windows for Qt 4.8.
Attachments
Issue Links
- replaces
-
QTBUG-34700 Custom paper size doesn't work with native format PDF output on Mac
- Closed
- resulted in
-
QTBUG-35500 Printing regression on Windows
- Closed
-
QTBUG-36348 Application asserts on printing with custom pageSizes
- Closed