Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.7.4
-
None
-
Mac 10.6.8
Description
When you try to render a QGraphicsScene to a QPainter operating on a QPrinter, the calculated target page size is incorrect.
The application below should display the scene within the printed page. (It works on Windows and X11.) On the Mac, the rectangle goes off the page to the right and bottom. Poking around, it looks like the device width and height are not being set correctly, so the default target page rect is wrong.
main.cpp
#include <QtGui> int main(int argc, char ** argv) { QApplication app(argc, argv); QGraphicsScene scene; scene.addRect(0., 0., 110., 197., QPen(), QBrush(Qt::BDiagPattern)); QGraphicsView view(&scene); view.show(); QPrinter printer(QPrinter::HighResolution); printer.setPaperSize(QPrinter::A4); printer.setPageMargins(50., 50., 50., 50., QPrinter::Millimeter); QPrintDialog dialog(&printer, &view); if (dialog.exec() == QDialog::Accepted) { QPainter painter(&printer); scene.render(&painter); } return app.exec(); }
Attachments
Issue Links
- is required for
-
QTBUG-25380 QtPrintSupport - Page Layout Issues
- Open
-
QTBUG-25383 QtPrintSupport - macOS Issues
- Closed