Results 1 to 4 of 4

Thread: Rich text with QPainter?

  1. #1
    Join Date
    Oct 2007
    Posts
    8
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Rich text with QPainter?

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Rich text with QPainter?

    You can use QTextDocument::drawContents() to draw a document on a painter.

  3. The following user says thank you to wysota for this useful post:

    sarefo (7th April 2008)

  4. #3
    Join Date
    Oct 2007
    Posts
    8
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Rich text with QPainter?

    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.

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Rich text with QPainter?

    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.

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  2. QTextEdit + paste rich text as plain text only
    By Yong in forum Qt Programming
    Replies: 2
    Last Post: 6th February 2008, 16:45
  3. Replies: 3
    Last Post: 13th December 2007, 16:10
  4. Rich Text Format
    By Kapil in forum Newbie
    Replies: 1
    Last Post: 4th October 2006, 10:53
  5. Painting Rich Text
    By xanthine in forum Qt Programming
    Replies: 7
    Last Post: 15th April 2006, 23:35

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.