PDA

View Full Version : Laying out affine text graphics items



Scorp2us
17th September 2009, 16:12
The QGraphicsTextItem class is not affine - does not scale or rotate well.
By using a QPainterPath and addText() I can make a affine version that does work well.
However addText() won't wrap for you. I tried to use a QPainter::drawText() which will, but it does not scale well at all. It has pixel flicker at some scales < 1. The QPainterPath version does not.

I attempted to use QTextLayout to implement a wrapping feature for my affine text, but quickly realized that QTextLine does not give you the text that will fit within the width. Instead, it expects it to draw on a painter. This is a major problem.

The ancillary problem is that I cannot create a QPainterPath from QPainter operations. If I could draw to some kind of a QPainterPathDevice, I could capture the drawing and store it in a PainterPath.

How am I supposed to provide a wrapping text feature with QPainterPath ?