Hi, all
I'm using a QTextEdit which is used for display a string on my application ,how do i know the string is richText ,or just plain text ,so I can choose two ways to process it ,any idea, thanks!
Hi, all
I'm using a QTextEdit which is used for display a string on my application ,how do i know the string is richText ,or just plain text ,so I can choose two ways to process it ,any idea, thanks!
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