I am using QPainter to drawText on QPrinter; however there is a problem. I hope I can draw colorful text. For example, the picture “Hello World”, where “H” is green, “ello” is yellow, and “World” is blue.
I am currently calling drawText 3 times and using different QPen to change the color. Moreover, I have to calculate the position where I need to draw 3 times. Finally, I could not align the string in QRect because I am not making a complete sentence. Is there a way to solve this in a simple way? Any hint is appreciated! Thank you
Arton source
share