tags:

views:

29

answers:

1

hello

i am making a software in which paint event painting a widget as per my need but the problem

is that when i re-size my application window it painted it again so please tell me the way

to stop paint event from painting my widget on resizing the main window.

my file are:

v_lab.h(http://qt.pastebin.com/tjHAWkPH)
v_lab.cpp(http://qt.pastebin.com/teJDmMmt)
main.cpp(http://qt.pastebin.com/gsUytaCN)

Thanks

+4  A: 

No, you do want to redraw every time the main window resizes. But your design is somewhat weird, as you are creating random stuff inside the paintEvent function. You should create that stuff elsewhere as needed, store that stuff in a QPixmap or something and just redraw the image in the paintEvent function.

In other words, paintEvent should only repaint the view in its current state and should not contain anything that changes the state.

teukkam
ok thanks...i will try it
Peeyush