PDA

View Full Version : calling event through in loop


raghvendramisra
27th February 2008, 06:39
Hi,
in my application i am using QCustomEvent and posting that event throug a for loop.

for(usIndex=0;usIndex<4;usIndex++)
{

EnggEvent *engEvent = new EnggEvent();
QApplication::postEvent(receiver, engEvent);

}

Now the problem is that when i do this the event get called only at the end of the loop i.e when the usIndex becomes 3.

How to solve this problem.

Regards
Raghvendra

ChristianEhrlicher
27th February 2008, 07:49
Search the forum or take a look at QCoreApplication::processEvents (http://doc.trolltech.com/4.3/qcoreapplication.html#processEvents)

jpn
27th February 2008, 07:54
Notice the difference between QApplication::sendEvent() and QApplication::postEvent().

raghvendramisra
28th February 2008, 06:41
Thnx .
I have used sendEvent() and it solved the problem......:)