PDA

View Full Version : QPrinter::PrinterMode and QPrinter::setResolution??



SkripT
26th April 2006, 15:27
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.

SkripT
28th April 2006, 09:13
Any suggestion, please? :crying:

jacek
28th April 2006, 12:59
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.


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.