Results 1 to 3 of 3

Thread: concurrent signals handling

  1. #1
    Join Date
    Jun 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question concurrent signals handling

    Hello,
    I have two slots each handling different signal.
    If a second signal is emitted while the first is still being processed the second slot handler is called only when the first is complete.
    Is it possible to handle second signal immediately and when it's complete to return back to the first ?

  2. #2
    Join Date
    Jun 2010
    Location
    France
    Posts
    7
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt Jambi
    Platforms
    Unix/X11 Windows

    Default Re: concurrent signals handling

    I think I answered to something similar recently.

    Here is what I wrote :

    Quote Originally Posted by fezvez View Post
    Take a look at : enum Qt::ConnectionType
    Basically, when you connect a signal to a slot, you do something like :
    Qt Code:
    1. connect(sender, SIGNAL(destroyed()), this, SLOT(objectDestroyed()));
    To copy to clipboard, switch view to plain text mode 

    But, there is one more parameter the connection type.

    If you look at the QObject::connect documentation, you will see that you are looking for this 5th argument : Qt::DirectConnection (documentation extract : The slot is invoked immediately, when the signal is emitted.)

    Basically, just type
    Qt Code:
    1. connect(sender, SIGNAL(destroyed()), this, SLOT(objectDestroyed()), Qt::DirectConnection);
    To copy to clipboard, switch view to plain text mode 
    I hope it answers your question =)

  3. #3
    Join Date
    Jun 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: concurrent signals handling

    Thank you fezvez. I tried with DirectConnection without success.
    But here in this forum I found a solution. I placed this:
    qApp->processEvents();
    in the loop of the first slot and it doesn't block any more.

Similar Threads

  1. Bug in MDI handling
    By daren in forum Qt Programming
    Replies: 1
    Last Post: 31st March 2009, 14:13
  2. Launching and handling posix or win32 signals
    By Althor in forum Qt Programming
    Replies: 2
    Last Post: 20th November 2008, 07:34
  3. Concurrent progress reporting
    By chezifresh in forum Qt Programming
    Replies: 1
    Last Post: 30th June 2008, 08:47
  4. conflict between boost signals and Qt signals
    By high_flyer in forum Qt Programming
    Replies: 2
    Last Post: 26th June 2008, 09:46
  5. QThread and signals (linux/UNIX signals not Qt Signals)
    By Micawber in forum Qt Programming
    Replies: 1
    Last Post: 28th November 2007, 22:18

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.