Heureka!
The Qt-Documentation is somewhat sparse at this point. In any case when printing with HighResolution you always have to specify the QPaintDevice before drawing. This applies to QFontMetrics where you need to instantiate the instance with
QFontMetrics fm(myFont, p->device()); // p = QPainter *
To copy to clipboard, switch view to plain text mode
Also, for the rich-text printing, you need to set the QPaintDevice before drawing. The code snipped below shows how it works:
layout->setPaintDevice(painter->device()); // this is needed for HighRes printing
context.
palette.
setColor(QPalette::Text, painter
->pen
().
color());
layout->draw(painter, context);
QAbstractTextDocumentLayout* layout = text.documentLayout();
layout->setPaintDevice(painter->device()); // this is needed for HighRes printing
QAbstractTextDocumentLayout::PaintContext context;
context.palette.setColor(QPalette::Text, painter->pen().color());
layout->draw(painter, context);
To copy to clipboard, switch view to plain text mode
Bookmarks