Details
-
Type:
Bug
-
Status: Reported
-
Priority:
P3: Somewhat important
-
Resolution: Unresolved
-
Affects Version/s: 5.15.0
-
Fix Version/s: None
-
Component/s: GUI: Printing
-
Labels:None
-
Environment:Tested on Windows
Description
According to the docs, calling QPrinter::setFullPage(true), should result in the origin of the QPrinter's coordinate system coincides with the top-left corner of the paper itself. This doesn't seem to be true.
Example
QPrinter printer; QPrintDialog dlg (&printer); if (dlg.exec() == QtDialog::Accepted) { printer.setFullPage(true); // printer.setPageMargins(QMargins(0,0,0,0)); // explicitly setting the margins to zero, fixes the bug. qDebug () << printer.margins().left << printer.margins().top << printer.margins().right << printer.margins().bottom; // Does not return zero (actual values depend on the default printer) QPainter p(&printer); p.drawRect(0,0,100, 100); // Rectangle will not coincide with the top left of the page. }
**Note that the problem only occurs if the default printer has a default margin not equal to zero.
Possible solution
Explicitly call setPageMargins(QMargins(0,0,0,0)); when setFullPage(true); is called.