[Interest] Recommended way to draw formatted text with QPainter

Joshua Grauman jnfo-c at grauman.com
Sat Dec 17 22:42:37 CET 2016


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!

Josh



More information about the Interest mailing list