Just like an HTML document, a QTextDocument object is a hierarchical structure. It is made up of frames, blocks, and fragments, which are defined as follows:
- A frame is represented by the QTextFrame object, and is a rectangular region of a document that can contain any type of content, including other frames. At the top of our hierarchy is the root frame, which contains all the document's contents.
- A block, represented by the QTextBlock object, is a region of text surrounded by line breaks, such as a paragraph or a list item.
- A fragment, represented by the QTextFragment object, is a contiguous region of text inside a block that shares a common text formatting. For example, if you have a sentence containing a word ...