PDA

View Full Version : Not able to receive the custom event from the event loop



Jagadeeshakr
19th July 2012, 21:30
I'm have an issue in recieving custom events. I have defined the event #define finishEvent ((QEvent::Type)(QEvent::User+1000)) and posting the event in some part of our source code as below
QCoreApplication: postEvent( this , new QEvent(finishEvent ) );

The posted event is captured in the following function
void CTestr::customEvent(QEvent *e)
{

if( e->type() == finishEvent ){
exit(0)
}
}

Both methods of post and receiving are in the same event loop(main thread) .

The problem is that the posted event('finishEvent') is not sent to the customEvent function in release mode. But I am able to receive the event properly when I debug the code.

We even added the event filter to the main thread but still was not able to see the event in the event filter.

Can you please help me on this why the custom event message is not reciving in the customEvent() event function.

wysota
20th July 2012, 11:47
Is the event loop running?