Results 1 to 2 of 2

Thread: Widget.render() function troubles

  1. #1
    Join Date
    Apr 2010
    Posts
    37
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Widget.render() function troubles

    What I'm trying to do is directly print a widget.
    How I have it right now is:

    Qt Code:
    1. QPrinter p(QPrinter::HighResolution);
    2. p.setPageSize(QPrinter::Letter);
    3. p.setFullPage(true);
    4. this->ui->tabPersonal->render(&p);
    To copy to clipboard, switch view to plain text mode 

    It does print, but it is TINY! Any ideas?

  2. #2
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Widget.render() function troubles

    It's due to:
    p.setPageSize(QPrinter::Letter); == 216 x 279 mm
    and:
    QPrinter::HighResolution; == 1200dpi / standard window screen dpi is around 96 WinXP and 72 - Lin <- AFAIR

    Change QPrinter p(QPrinter::HighResolution); to : QPrinter p(QPrinter::ScreenResolution); for example.

    To explain why that's happens (image is small in print) calculate:
    my screen resolution = 1600x1200 in 1200dpi == 33.8x25mm
    QPrinter::Letter = 216 x 279 mm
    so my screen after print is approximately ten times smaller.

    Regards

Similar Threads

  1. Big troubles when deploying on Mac
    By NoRulez in forum Installation and Deployment
    Replies: 0
    Last Post: 11th February 2010, 15:27
  2. Replies: 4
    Last Post: 11th June 2009, 20:19
  3. [noob] How can I have a widget event call a function?
    By Envergure in forum Qt Programming
    Replies: 5
    Last Post: 26th November 2008, 23:17
  4. libqjpeg troubles
    By TheRonin in forum Installation and Deployment
    Replies: 6
    Last Post: 25th August 2006, 15:48
  5. QTextEdit troubles?!
    By Jojo in forum Qt Programming
    Replies: 2
    Last Post: 21st February 2006, 16:54

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.