May 2019
Intermediate to advanced
542 pages
13h 37m
English
The InvoiceView class is where all the hard work takes place; we will base it on a read-only QTextEdit widget, and it will contain a build_invoice() method that, when called with a dictionary of data, will construct a formatted invoice document using the Qt Scribe framework.
Let's start with the constructor, as shown in the following example:
class InvoiceView(qtw.QTextEdit): dpi = 72 doc_width = 8.5 * dpi doc_height = 11 * dpi def __init__(self): super().__init__(readOnly=True) self.setFixedSize(qtc.QSize(self.doc_width, self.doc_height))
To begin, we've defined class variables for the document's width and height. We've chosen these values to give us the aspect ratio of a standard US letter-sized document at a reasonable ...
Read now
Unlock full access