QPrinter/KPrinter default resolution
lars at trolltech.com
Tue Jan 11 14:02:09 GMT 2005
On Friday 07 January 2005 17:28, Lubos Lunak wrote:
> QPrinter/KPrinter default to QPrinter::ScreenResolution as the printer
> mode, and KPrinter's setUsePrinterResolution() defaults to false. This
> leads to using relatively low resolution when printing, which is especially
> visible with images.
Which it doesn't have to be. If you have a high resolution version of the
image, you can use
drawPixmap/drawImage(const QRect &r, const QPixmap/QImage &img).
This will on the screen scale the image to the requested rectangle, and keep
the complete high resolution version of the image on the printer.
Some other things that lead to lower quality is the limitation to integer
coordinates with QPainter has in Qt 3. So at ScreenResolution you might not
be able to position object to the accuracy you would like on a printer.
On the other hand ScreenResolution is very convenient, as you do have the same
(font)metrics on both screen and printer. At HighResolution they are
completely different requiring you to do a lot of calculations and making
sure you pick the correct font metrics (the one from the painter, not the one
from the font directly).
The main problem is that you can't do the layouting before you have opened a
painter on the printer (as you need it to get correct metrics). This is
fortunately fixed in Qt 4, making HighRes printing a lot easier.
> I'd like to suggest defaulting to setUsePrinterResolution() being true,
> and printer mode being QPrinter::HighResolution. Alternatively (for KDE4
> only :-/ ), removing the default value for the printer mode, so that the
> app developer must choose and will know about this, and having using
> printer resolution as another argument for ctor, or making it another
> printer mode. This alternative would mean apps for KDE3.4 would have to be
> checked and changed manually, like in http://bugs.kde.org/91644 .
Both modes have advantages and disadvantages. For Qt 4 we have tried some
things to make it easier to achieve high res printing in Qt4, so maybe the
default should be HighResolution there.
> Would there be any reasons to default to such low dpi values like
> QPrinter/KPrinter currently do? I can think of images in image viewers
> being printer smaller with higher dpi, but those usually have adjusting the
> image size anyway. Would this also affect e.g. text editors?
It doesn't hurt as much as you think, as you can print high resolution images
even with ScreenResolution; see above.
More information about the kde-core-devel