Easiest way to print text with multiple fonts using QPainter?
I'm using a MainWindow status bar to display a moving status drawing, which is light colored on the left and black on the right side. I'm currently using QPainter::drawText to draw black text on the left side, but now I'd like to print some white text on the right side as well. I was hoping that there would be an overloaded version of drawText() that would allow passing in a font specification, either with QString and QFont as parameters or with QTextItem as the input parameter. However, I don't see one. Instead, font is set for the entire QPainter. So I think my only option is to set the font of QPainter, drawText, then change the font of the QPainter and draw the other text.
Yes, that is indeed how QPainter works. You set a mode, you paint a bit, you change the mode, you paint some more...
Ok, thanks. This method is working fine for me.