Results 1 to 3 of 3

Thread: QPrinter setFullPage(): Win/Linux Diffs

  1. #1
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Question QPrinter setFullPage(): Win/Linux Diffs

    Hi All,

    I'm having a bit of fun with cross-platform differences in printing. I use QPrinter::setFullPage() to allow me to place a full-page sized template of a complex form (from an SVG file) on the page. On Linux it works fine. On Windows the template image is offset because, apparently, full page does not mean that on Windows (except when the print is directed to PDF). This test code:
    Qt Code:
    1. #include <QtGui>
    2.  
    3. int main(int argc, char *argv[])
    4. {
    5. QApplication app(argc, argv);
    6.  
    7. QPrinter p(QPrinter::HighResolution);
    8. p.setPaperSize(QPrinter::A4);
    9. p.setOrientation(QPrinter::Landscape);
    10. p.setFullPage(true);
    11. qDebug() << "Page rect: " << p.pageRect();
    12. qDebug() << "Paper rect: " << p.paperRect();
    13.  
    14. QWidget mainWin;
    15. mainWin.show();
    16. return app.exec();
    17. }
    To copy to clipboard, switch view to plain text mode 

    On Linux prints:
    Qt Code:
    1. Page rect: QRect(0,0 14033x9917)
    2. Paper rect: QRect(0,0 14033x9917)
    To copy to clipboard, switch view to plain text mode 
    as the docs imply, and Windows:
    Qt Code:
    1. Page rect: QRect(99,99 6814x4760)
    2. Paper rect: QRect(0,0 7016x4961)
    To copy to clipboard, switch view to plain text mode 

    Firstly, can others confirm this behaviour? Secondly, is the only way around this to let Windows have its ~5mm border* all round, force the same on Linux, and shrink my template accordingly?

    * Actually it will have to be at least as large as the largest printer border the app is likely to encounter because I guess the figures come from the printer driver on Windows.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QPrinter setFullPage(): Win/Linux Diffs

    Thanks to those who have read this post.

    I think it is a bug and will report it.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QPrinter setFullPage(): Win/Linux Diffs

    I thought I'd bump this and see if anyone has any ideas.

    I reported an error to Nokia (#261362) but, despite receiving an auto-response, it has not appeared in the task tracker. Is that normal?

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.