PDA

View Full Version : How to change the default text colour of QTextEdit?



ohmyqt
2nd September 2011, 21:07
Hi all,

I'm using QTextEdit. I want the program to change the text colour randomly with every character I type. So, I will get outputs that look like this:

abcdefgh abcdefgh abcdefgh

How to I command QTextEdit to change the "brush color" of the font when I type?

I just need the code that tells QTextEdit to change colors whenever there's a QTextEdit::textChanged () [signal]

Thanks!

high_flyer
5th September 2011, 16:04
Instead of giving you a fish, we prefer here to teach you how to fish.
Have a look at QTextEdit::setCurrentCharFormat().
Ask if you get stuck.

ohmyqt
6th September 2011, 06:55
Brilliant! That was what I needed. Thanks!