PDA

View Full Version : not getting the event from Postevent() to Custom event() in Qt4



node_ex
24th June 2008, 16:06
Hello,

postEvent() is called from a separate thread, where as customEvent() is in main thread, After the postEvent() method called from thread , customEvent() of reciever is not receiving the event.

Regards,
node_ex.

jpn
24th June 2008, 16:23
Try to provide more information. I've used it in a few projects and I never had problems with it. Did you pass something between QEvent::User and QEvent::MaxUser as event type?

node_ex
25th June 2008, 05:08
Hi,

Thanks for the reply.

I am converting Qt3 application to Qt4 application . Here application didn't call QApplication::exec() fn before calling postEvent fn.

Event is passed by using QCustomEvent class .
QApplication::postEvent(QObject*,QCustomEvent*) is called in thread( which is not inherited from QThread ... basic c++ thread using pthread_create() function). customEvent(QCustomEvent*) function is located in the respected QObject class. This customEvent is not getting called after postEvent method is invoked.

The same worked in Qt3, but not working in Qt4..

Regards,
node_ex.

wysota
25th June 2008, 07:27
In Qt4 there is no virtual method customEvent that takes a QCustomEvent pointer.

node_ex
25th June 2008, 11:03
hi,

I used QEvent in place of QCustomEvent class and application works good.

Thanks for your prompt help.

Regards,
node_ex.