PDA

View Full Version : processEvents causing multiple events



jefferai
29th June 2008, 21:45
I have a QGraphicsView subclass. When the mouse is dragged over it and then leaves it, the QDragLeaveEvent triggers a timeline to animate hiding the QGV. The problem is that in another area in my program, I want to make sure that if the animation is running it finishes, so I put a


while( fadeTimer.state() == QTimeLine::Running )
QApplication::processEvents

What's happening is that this is causing multiple QDragLeaveEvents to get sent to my QGV, resulting in an eventual crash. Why am I getting these multiple events and how do I avoid it?

Thanks.

jpn
30th June 2008, 08:08
How about starting the action after QTimeLine::finished() has been emitted, instead of that nasty event processing loop?