Details
-
Bug
-
Resolution: Fixed
-
P3: Somewhat important
-
5.15.0
-
None
-
Tested on Windows
-
652065b06 (dev)
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.
Attachments
Issue Links
- relates to
-
QTBUG-118580 QPrinter::setPageLayout does behaves different on windows and Linux
- Closed
-
QTBUG-119003 QPrinter fullPage mode behaves differently on Windows than on Mac and Linux
- Closed
For Gerrit Dashboard: QTBUG-95927 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
545173,5 | Honor QPrinter::setFullPage(true) on Windows too (no margins) | dev | qt/qtbase | Status: MERGED | +2 | 0 |