As far as I know it's not possible. You can either set background/text color for entire QTextEdit or use html as You have done. It is possible to create function that will wrap Your char into html and set random color and function that will take back only char from html. The second is easy. You can take entire text from QTextEdit, put it in QTextDocument object and use function toPlainText(), then you have Your text as QString without any html.
Bookmarks