Every application that supports rich text must have some format to represent that text in memory and when saving it to a file. Some formats use custom binary code, such as the .doc and .rtf files used by older versions of Microsoft Word. In other cases, a plain-text markup language is used. In a markup language, special strings called tags indicate the placement of rich text features. Qt takes the markup approach and represents rich text using a subset of hypertext markup language (HTML) version 4.
Rich text markup in Qt is rendered by the QTextDocument object, and as such it is only usable on widgets that use QTextDocument to store their contents. This includes the QLabel, QTextEdit, and QTextBrowser widgets. In this section, we're going to create a demo script to explore the syntax and capabilities of this markup language.
Given the popularity...