I am trying to post event from a thread using postEvent() method and that should send a "custom event " to the event loop. But Somehow postEvent is not working correctly and it never called customEvent.
Any idea will be helpful.
///////Header File////////
class CustomThreadEvent
: public QEvent{
public:
CustomThreadEvent()
};
/////METHOD////////////
void MyThreadEvent
::EraseThread( QThread *pErase
) {
CustomThreadEvent *pCustomThreadEvent = new CustomThreadEvent;
if ( pCustomThreadEvent)
{
pCustomThreadEvent->pErase = pErase;
//Calling Post Event
}
}
///////Header File////////
class CustomThreadEvent : public QEvent
{
public:
CustomThreadEvent()
: QEvent( (QEvent::User + 150)) {}
QThread *pErase;
};
/////METHOD////////////
void MyThreadEvent::EraseThread( QThread *pErase)
{
CustomThreadEvent *pCustomThreadEvent = new CustomThreadEvent;
if ( pCustomThreadEvent)
{
pCustomThreadEvent->pErase = pErase;
//Calling Post Event
QApplication::postEvent( this, pCustomThreadEvent );
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks