Results 1 to 9 of 9

Thread: PostEvent

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2007
    Posts
    92
    Thanks
    14
    Thanked 1 Time in 1 Post

    Default PostEvent

    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.
    Qt Code:
    1. ///////Header File////////
    2.  
    3. class CustomThreadEvent : public QEvent
    4. {
    5. public:
    6. CustomThreadEvent()
    7. : QEvent( (QEvent::User + 150)) {}
    8.  
    9. QThread *pErase;
    10. };
    11.  
    12.  
    13. /////METHOD////////////
    14.  
    15. void MyThreadEvent::EraseThread( QThread *pErase)
    16. {
    17.  
    18.  
    19. CustomThreadEvent *pCustomThreadEvent = new CustomThreadEvent;
    20.  
    21. if ( pCustomThreadEvent)
    22. {
    23. pCustomThreadEvent->pErase = pErase;
    24.  
    25. //Calling Post Event
    26.  
    27. QApplication::postEvent( this, pCustomThreadEvent );
    28.  
    29. }
    30. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by jacek; 31st May 2007 at 23:19. Reason: missing [code] tags

Similar Threads

  1. Replies: 4
    Last Post: 26th July 2006, 07:06
  2. postEvent() to a non-existing receiver
    By Artschi in forum Qt Programming
    Replies: 7
    Last Post: 1st June 2006, 14:44
  3. using postEvent, but still getting async error
    By ender in forum Qt Programming
    Replies: 1
    Last Post: 24th May 2006, 17:15

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.