Results 1 to 2 of 2

Thread: QObject's event method not being called

  1. #1

    Default QObject's event method not being called

    Hi all,

    I have a sub-class of QObject (let's call it MyObject) which overrides the event() method.

    A thread, not on the QCoreApplication main thread, is creating events and posting, as in:

    Qt Code:
    1. MyEvent *e = new MyEvent; // subclass of QEvent
    2. QCoreApplication::postEvent(&MyObject, e);
    To copy to clipboard, switch view to plain text mode 

    Now, my problem is that there seems to be some sort of race condition, as sometimes my program runs and works fine, i.e. the event() method is called, allowing events to be processed by MyObject.

    But on other occasions, the event() method is never being called.

    Any ideas of where to go looking for this? Does it mean something else is blocking the main event loop?

    Cheers,
    Jono

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QObject's event method not being called

    We'd have to see more code. But there shouldn't be any race conditions - post event is thread safe.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 4
    Last Post: 19th February 2009, 11:10
  2. Custom event gets not propagated to the top level widget
    By nightghost in forum Qt Programming
    Replies: 0
    Last Post: 29th January 2009, 09:06
  3. Qt event queue overloading?
    By gct in forum Qt Programming
    Replies: 3
    Last Post: 17th March 2008, 18:39
  4. Replies: 4
    Last Post: 10th March 2007, 18:01

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.