PDA

View Full Version : TextColor in QTextEdit



johnmauer
15th June 2010, 23:00
What is the most efficient way to reset the color of all the text in a QTextEdit? SetTextColor only sets the color of the current format and does not change existing text. Thanks for any help.

CeeKey
16th June 2010, 07:48
Hey,

stylesheets would solve your problem. Create a Stylesheet and set it to your QTextEdit.

Lykurg
16th June 2010, 08:08
If you don't have any other format in the text: save the text to a QString, clear the edit and set the text with the new color. Otherwise I guess you have to loop through your text formats.

johnmauer
16th June 2010, 13:08
Thanks. I've tried setting the StyleSheet, but it is overridden by the text formats. Saving and clearing works fine; the only other format was a base font.