Results 1 to 3 of 3

Thread: execution of slots

  1. #1
    Join Date
    Jan 2006
    Posts
    18
    Qt products
    Qt4
    Platforms
    Windows

    Default execution of slots

    hi all,

    i have connected a signal A with a slot T and i would like to know what would happen if:

    1) A is fired -> T is invoked the first time
    2) A is fired again, while the first call of T still is in progress

    now, does qt start the slot T directly such that several "instances" of the method are running
    or does it wait until the first invocation of T terminates???

    (by the way, it is a simple GUI, no multi-threaded app)

    thanks

    smalls

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: execution of slots

    Quote Originally Posted by smalls
    now, does qt start the slot T directly such that several "instances" of the method are running or does it wait until the first invocation of T terminates???
    Direct connections behave just like function calls. Every time you emit a signal, Qt will call the first connected slot, when it returns second slot will be invoked and so on. If there is an emit statement inside a slot, Qt will start invoking apropriate slots immediately.

    Queued connections behave like custom events from Qt3 --- emit statement posts an event to apropriate event queue and slot is invoked when that event loop picks up this event.

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    85
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: execution of slots

    Since you are single-threaded the calls are done imediately by the main / GUI thread. That means emit calls the slots one after the other - only the order is undefined.

Similar Threads

  1. Replies: 12
    Last Post: 23rd June 2008, 08:05
  2. Replies: 12
    Last Post: 9th April 2008, 13:49
  3. Slots or new slots
    By Colx007 in forum Qt Programming
    Replies: 3
    Last Post: 21st January 2008, 17:38
  4. Adding slots in Designer
    By jamos in forum Qt Tools
    Replies: 5
    Last Post: 18th May 2006, 23:28
  5. Missing slots
    By Mariane in forum Newbie
    Replies: 1
    Last Post: 5th February 2006, 01:50

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.