Important: Please read the Qt Code of Conduct -

Displaying RTF Text

  • I am being sent a string of text in the Microsoft rtf format. I have to display it. Can someone show me a simple example of how to display a string of rtf text?

    I should add that I do not need to edit it, search it, or do any other type of processing - only display it in a box of any kind. Please don't give me links to the top level of a library that does a thousand things. I only need to display a string of text.

    If I cannot display the rtf, it would probably be enough to be able to extract the plain text from it.

    Thanks in advance.


  • QLabel supports rich text. Just call QLabel::setText.

  • I tried it and it didn't work. It showed every tag. Then I tried it formatted with some simple HTML instead and that worked. However, I do not have HTML. This is Microsoft rtf format.

  • I don't think microsoft's rtf format is supported then straight out of the box.

  • I just wondered if anyone had figured anything out. I'm not really a QT expert and I hoped that maybe someone had a solution.

  • I found this, you might be able to use it. Not sure what the licensing is on it though.

    "Rtf parser written with Qt":

  • It's very kind of you to find this for me. Is it a library or an executable?

    Nothing without 3rd party resources, though?

  • It's a library to parse Microsoft's rtf format. It is under the GNU LGPL v2.1 license. Someone else may be able to point you in a better direction. I think I ignored the Microsoft part when reading the post.

Log in to reply