Horizontal line in QTextDocument
Hi, I'm creating a QTextDocument and print it as PDF to a QPrinter with QTextDocument::print (). I can create text and tables, but I would like to insert a simple horizontal line to separate some paragraphs.
I tried to create an empty frame like this:
Code:
oLineFormat.setHeight (1);
oLineFormat.setWidth (100);
oDocumentCursor.insertFrame (oLineFormat);
oDocumentCursor.insertText (" ");
but it did not shown up in my printed PDF.
I read the text object example, but do I really have to create my own TextObject for this? Or is there a simpler way to draw a line?
Ginsengelf
Re: Horizontal line in QTextDocument
The easiest way is to call:
Code:
oDocumentCursor.insertHtml("<hr/>");
If you wish to know how to insert a line "manually", analyze the block inserted by the above statement and modify it to suit your needs.
Re: Horizontal line in QTextDocument
Thanks, I did not think about HTML :)