View Full Version : QString is a richText or plain text
SamSong
12th June 2009, 08:32
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!
auryce74
14th June 2009, 00:19
Why don't you just pass your string to the QTextEdit using the setHtml (http://doc.qtsoftware.com/4.5/qtextedit.html#html-prop) 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).
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.