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.