PDA

View Full Version : Calling paintEvent when I want to



di_zou
13th October 2009, 18:56
I have a paintEvent function. However, I don't want this function to be called when the widget is created. I want to control when it is called. I know update() will let me call the paintEvent function, but how do I prevent paintEvent from being called at start up?

codebehind
13th October 2009, 20:09
create a bool variable and check it in your paint function
at the creation time set it to false and later when you want the paintevent todraw set it to true.

scascio
14th October 2009, 10:05
This famous boolean seems to be already in the widget and can be managed by QWidget::setUpdatesEnabled

yan
14th October 2009, 11:29
Hi
hide the widget after creation.
Normally, paintevent will not be called.