Results 1 to 4 of 4

Thread: Multiple QPainters on QImage

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: Multiple QPainters on QImage

    Why do you want to repaint the image during every paintEvent? If nothing changed, the image doesn't have to be repainted. Implement a render method for your content that takes a QPainter* as an argument and when you want to repaint the image call it on the image's painter. In the paintEvent call it again but on the widget's painter.

  2. #2
    Join Date
    Aug 2008
    Posts
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Multiple QPainters on QImage

    Quote Originally Posted by wysota View Post
    Why do you want to repaint the image during every paintEvent? If nothing changed, the image doesn't have to be repainted. Implement a render method for your content that takes a QPainter* as an argument and when you want to repaint the image call it on the image's painter. In the paintEvent call it again but on the widget's painter.
    Although I have it set up as a rotating picture, I plan to change the code to read new pixel data from a file source and place it at the top of the picture.

    I would also like to be able to place the updated images to another widget and/or save it to a file, hence why I wanted a place holder (the QImage object) for the new image data.

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

    Default Re: Multiple QPainters on QImage

    But it doesn't answer why you repaint the image in the paintEvent and not elsewhere. The paintEvent may be called for instance when something obscures your widget. There is no point in redrawing the image in such a situation.

Similar Threads

  1. Replies: 12
    Last Post: 7th September 2011, 16:37
  2. QShared
    By sabeesh in forum Qt Programming
    Replies: 11
    Last Post: 11th October 2007, 12:40
  3. how to corss compile for windows in Linux
    By safknw in forum Qt Programming
    Replies: 24
    Last Post: 13th May 2006, 05:23

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
  •  
Qt is a trademark of The Qt Company.