PDA

View Full Version : First QTextBlockFormat not picked up in QTextFragment



enno
19th February 2010, 20:00
I am trying to produce a print version of a QTextDocument, prDoc, by adding some headers and footers around fragments of a QTextDocument, doc, displaying properly.

Even when the QTextCursor used to define the selection has anchor position 0 the QTextFragment, when inserted in prDoc, does not have the tabs defined in the QBlockFormat of that first block in doc.

Any suggestions what I could be doing wrong?

Second, but less pressing, question. Is there a way to stop Qt printing pagenumbers when printing a document. The page number, together with more info is already in my footer.

Thanks,
Enno

enno
20th February 2010, 10:28
My error was not reading the documentation. QTextFragment is more concerned with character than block formats. Explicitly obtaining the doc's block format and insering the selection into a new block in prDoc with that block format set solves that problem. It appears in this case useful that the block formats of all subsequent blocks in the selection are transferred.

That leaves the second part of the question. Can I stop Qt inserting page numbers when printing. Any suggestions?

Enno.