May 2019
Intermediate to advanced
542 pages
13h 37m
English
The last thing we're going to insert in our invoice is a table containing our line items. QTextTable is a subclass of QTextFrame, and just like a frame, we'll need to create a format object for it before we can create the table itself.
The class we need is the QTextTableFormat class:
table_format = qtg.QTextTableFormat() table_format.setHeaderRowCount(1) table_format.setWidth( qtg.QTextLength(qtg.QTextLength.PercentageLength, 100))
Here, we've configured the headerRowCount property, which indicates that the first row is a header row and should be repeated at the top of each page. This is equivalent to putting the first row in a <thead> tag in markup.
We're also setting the width, but instead of using pixel values, we're ...
Read now
Unlock full access