Thanks for the tip, Jacek.
However, I can't get anything to appear via QAbstractTextDocumentLayout::draw(). For example, here is some test code that doesn't work:
ctx.
clip = QRectF( 0,
0,
400,
100 );
qPainter->drawRect( ctx.clip ); // Test that I'm drawing in the right area
td.documentLayout()->draw( qPainter, ctx );
QTextDocument td( "test" );
QAbstractTextDocumentLayout::PaintContext ctx;
ctx.clip = QRectF( 0, 0, 400, 100 );
qPainter->drawRect( ctx.clip ); // Test that I'm drawing in the right area
td.documentLayout()->draw( qPainter, ctx );
To copy to clipboard, switch view to plain text mode
The clip rectangle gets drawn properly, but no text is drawn.
I've tried looking at how QTextEdit draws its QTextDocument, and I can't see anything significantly different to what I am doing, but obviously there must be something..
Any ideas?
Bookmarks