Results 1 to 3 of 3

Thread: QPrinter::PrinterMode and QPrinter::setResolution??

  1. #1
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Unhappy QPrinter::PrinterMode and QPrinter::setResolution??

    Hi all, I want to know why there are two ways of setting QPrinter's resolution: using PrinterMode and setResolution. Do they work with the same parameter? Moreover, if I change the resolution with setResolution the volume of the final document (printing in a PDF file) is always the same. Is it a bug of Qt or it's just the correct behaviour?.

    I need the resolution because I have to set the page margins from their size in centimeters. Could you suggest me which value of resolution should I use, the one from PrinterMode or the returned calling QPrinter::resolution()??

    Thanks.
    Last edited by SkripT; 26th April 2006 at 17:06.

  2. #2
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPrinter::PrinterMode and QPrinter::setResolution??

    Any suggestion, please?

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 975 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPrinter::PrinterMode and QPrinter::setResolution??

    Quote Originally Posted by SkripT
    Hi all, I want to know why there are two ways of setting QPrinter's resolution: using PrinterMode and setResolution. Do they work with the same parameter?
    No, they don't:
    void QPrinter::setResolution ( int dpi )
    Requests that the printer prints at dpi or as near to dpi as possible.
    This setting affects the coordinate system as returned by, for example QPainter::viewport().
    This function must be called before QPainter::begin() to have an effect on all platforms.
    See also resolution() and setPageSize().
    Using this method you can set the resolution (in dots per inch).

    While PrinterMode only controls the default resolution:
    enum QPrinter::PrinterMode
    This enum describes the mode the printer should work in. It basically presets a certain resolution and working mode.
    Quote Originally Posted by SkripT
    Could you suggest me which value of resolution should I use, the one from PrinterMode or the returned calling QPrinter::resolution()?
    Only QPrinter::resolution() returns the resolution.

  4. The following user says thank you to jacek for this useful post:

    SkripT (28th April 2006)

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.