Why don't you just pass your string to the QTextEdit using the setHtml function?
If the string contains any HTML markup, then QTextEdit will use this to format the text, if not, it will - well - just show the text.
You can however (in case you want to know this for processing independent of displaying the text in the QTextEdit), use the Qt::mightBeRichText function on any QString. The function checks whether the text of the QString contains something that looks like rich text markup (HTML tags, basically).
Bookmarks