In addition to allowing us to specify rich text in markup, Qt provides us with an API to create and manipulate rich text programmatically. This API is called the Qt Scribe Framework, and it's built around the QTextDocument and QTextCursor classes.
To demonstrate how to create a document using the QTextDocument and QTextCursor classes, we're going to build a simple invoice generator application. Our application will take data from a widget form and use it to generate a rich text document programmatically.