Results 1 to 4 of 4

Thread: signal getting caught in another event loop

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: signal getting caught in another event loop

    Quote Originally Posted by raj_iv View Post
    This class is running in main event loop.
    There is only one event loop (per thread). QEventLoop only provides a different entry point to the existing event loop. Events do not care if they are handled as a result of QEventLoop::exec() or QCoreApplication::exec(). The only difference is that calling exec() on QEventLoop bumps up an internal level counter in the event loop which cares that deferred delete (aka QObject::deleteLater()) is executed on the same (or lower) level at which the delete was scheduled. In other words, if you do this:
    Qt Code:
    1. QObject *obj = ...;
    2. obj->deleteLater();
    3. loop.exec();
    4. bool b = obj->isStillThere();
    To copy to clipboard, switch view to plain text mode 

    "obj" is still valid after loop.exec() returns.
    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.


  2. The following user says thank you to wysota for this useful post:

    raj_iv (29th September 2012)

Similar Threads

  1. Replies: 25
    Last Post: 28th October 2011, 20:22
  2. Replies: 1
    Last Post: 22nd July 2010, 09:16
  3. event loop isStarted() signal?
    By Xerion in forum Qt Programming
    Replies: 1
    Last Post: 18th February 2008, 21:45
  4. signal and slot across threads having event loop
    By travis in forum Qt Programming
    Replies: 6
    Last Post: 5th November 2007, 23:56
  5. Replies: 4
    Last Post: 23rd January 2006, 16:51

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
  •  
Qt is a trademark of The Qt Company.