PDA

View Full Version : Rich text with QPainter?



sarefo
7th April 2008, 11:52
i currently create a report that is saved in a pdf file using a QPainter. I used QTextDocument earlier, but the layout possibilities were too limited. But now i ran into the problem of creating rich text inside the report. I figured out to have different fields display in different fonts, weights etc. by using painter.setFont() before every change, but found no way to easily display superscripts etc.

wysota
7th April 2008, 13:24
You can use QTextDocument::drawContents() to draw a document on a painter.

sarefo
7th April 2008, 14:34
thanks for the prompt and helpful reply, i overlooked this function. it would be easier if one could absolutely position the produced richt text, but it's working now.

wysota
7th April 2008, 14:40
What do you mean by "absolutely position"? You may provide your own layout engine, if you want. Thus it is possible to have full control over the document.