How we can avoid erasing of previous image while repainting?



  • If we called a repaint two times the previous image in paintevent is erased. How can we avoid erasing of this image.



  • Could you please rephrase your question. What do you want to achieve?

    That a redraw of a widget paints onto the previous state of the widget?



  • Actually i have two images one is semi-transparent and other is opaque and smaller image than previous one. Suppose In first case i have painted an image on a widget on the second time while painting on the same widget i want that the first painted image should not be erased. So that non_overlapped portion of both the image i can see after the second paint event. Is it possible?



  • Well, in most of cases the code in paintEvent defines what is widet will show right after is is called (and after repaint(), of course). So if you want some images to be combined you should draw it in one paintEvent



  • Then you have to disable background erasing (see QWidget attributes)
    and handle all that on your own.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.