Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.7.2
-
Mac 10.6.7
-
-
5f35882f91ff5634b1694d1f6d62c057d278b1a6
Description
Whenever you use the QPrinter::setPaperSize overload that accepts a QSizeF& and QPrinter::Unit on the Mac, it corrupts the paper size structure internally, causing printouts to render in completely the wrong location. If you specify the exact same paper size using the overload that accepts a QPrinter::PaperSize, it works fine.
main.cpp
#include <QtCore> #include <QtGui> int main(int argc, char **argv) { QApplication app(argc, argv); QPrinter printer(QPrinter::HighResolution); printer.setPaperSize(QSizeF(8.5, 11.0), QPrinter::Inch); // printer.setPaperSize(QPrinter::Letter); // <- this will work fine. QPrintDialog dialog(&printer); if (dialog.exec() == QDialog::Accepted) { QPainter painter(&printer); painter.drawEllipse(0, 0, 100, 100); } }
The expected output would have a circle in the top-left corner. The actual output puts in near the bottom-left, but not entirely in the corner. It thinks that point (0,0) is somewhere near the bottom of the page.