Results 1 to 3 of 3

Thread: QPainter(&QPrinter) & QPainter(&QImage) communication

  1. #1
    Join Date
    Jul 2009
    Posts
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default QPainter(&QPrinter) & QPainter(&QImage) communication

    Hello everybody. Please hear me out...

    I declare a QPainter over a QPrinter and draw some images, some text, it doesn't matter.
    I also would like to have an option to save the specific content as an image (.png, .img).

    Here comes my problem:

    When printing to the printer, I apply to QPrinter object some properties, such as page orientation, page size, etc.
    Afterward when I try to print over a QImage the same thing, I must declare a QPainter(&QImage).
    What must I do to keep QPainter's properties (page orientation.. as I mentioned upper) over the QImage, so that
    the saved file will have the same properties (or how can I take those properties from the QPrinter's QPainter object).

    Thanks a lot

  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: QPainter(&QPrinter) & QPainter(&QImage) communication

    You can try calling QPainter::begin() on the other paint device but logically this will reset the transformations too.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jul 2009
    Posts
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default

    Yap you're right, properties are being reset.

Similar Threads

  1. QPainter bug or QPrinter bug?
    By lni in forum Qt Programming
    Replies: 6
    Last Post: 30th March 2009, 02:48
  2. QPrinter, QPainter, and Large Amounts of Data
    By millsks in forum Qt Programming
    Replies: 0
    Last Post: 17th March 2009, 19:26
  3. Replies: 5
    Last Post: 15th January 2009, 10:03
  4. QPainter & QPrinter on linux (fedora 7)
    By wbt_ph in forum Qt Programming
    Replies: 4
    Last Post: 20th October 2007, 16:37
  5. QPainter & QPrinter
    By munna in forum Qt Programming
    Replies: 3
    Last Post: 18th September 2006, 15:19

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.