[Interest] Recommended way to draw formatted text with QPainter

André Somers andre at familiesomers.nl
Mon Dec 19 20:20:10 CET 2016


Hi,


Op 17/12/2016 om 22:42 schreef Joshua Grauman:
> Hello all,
>
> I have a bunch of small fragments of formatted text (small paragraphs 
> with multiple colors and fonts, using <span> tags). I need to paint 
> them with QPainter at different locations (multiple rectangles of 
> text) onto my widget. I've seen recommendations to put them in a 
> QLabel and then call QLabel::render(), or to use QTextDocument and 
> drawContents(). Are there any other ways to do it? Which is 
> recommended for best results/fastest drawing? Thanks!
QStaticText is designed for exactly that purpose.

André



More information about the Interest mailing list