Results 1 to 2 of 2

Thread: Draw an image as background at the erase background time (and not paint time)

  1. #1
    Join Date
    Jun 2010
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Draw an image as background at the erase background time (and not paint time)

    Hello everyone,

    I have a big big problem.

    When I receive the WM_ERASEBKGND message, I need to take make some operation to build an image in order to put it as a background of my widget.

    The problem is that the background is grey during the time I'm building the image. So, when the user resize the window, my widget wink and it's not beautiful.

    So I would like to know if I could capture the WM_ERASEBKGND event, build the image and do something for making Qt use it when it's making the erase background operation ?

    Thank you very muck

    Aurélien

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Draw an image as background at the erase background time (and not paint time)

    First things first: without doing some magic voodoo, Qt can only paint on widgets inside the paint event.

    With that in mind, you know that you will always need to paint the background from within the paint event.

    Flickering of the background can be solved by making use of double buffering.
    http://doc.trolltech.com/qq/qq06-flicker-free.html

Similar Threads

  1. Replies: 12
    Last Post: 25th December 2009, 16:07
  2. Replies: 5
    Last Post: 20th October 2009, 08:18
  3. calculate draw time
    By johnsoga in forum Qt Programming
    Replies: 1
    Last Post: 30th May 2009, 03:03
  4. Draw transparent SVG in Background of Widget
    By soul_rebel in forum Qt Programming
    Replies: 0
    Last Post: 28th October 2008, 21:44
  5. How to show/draw focus & select at the same time
    By tanminh in forum Qt Programming
    Replies: 2
    Last Post: 6th November 2006, 22:06

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.