Results 1 to 7 of 7

Thread: Question about signal and slots

  1. #1
    Join Date
    Sep 2016
    Posts
    78
    Thanked 1 Time in 1 Post
    Qt products
    Qt5

    Question Question about signal and slots

    Hi i have one question about this. For example different signals can be emitted at the same time and if one signal never finish wha thappen with others. The signal need to wait the other the other signal finish to start?.
    When it's recommended use differents QObjects? when we need different programs or when? Thx in advance.
    Last edited by davinciomare; 5th October 2016 at 21:09.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Question about signal and slots

    For example different signals can be emitted at the same time
    No, not correct. Signals are emitted one at a time (unless there are multiple threads), but they are always handled one at a time.

    if one signal never finish what happen with others
    If the slot that is connected to the signal never finishes, then your program (or the thread that has the slot) will be stuck forever in that slot.

    The signal need to wait the other the other signal finish to start?.
    See the first answer. The slots connected to the signals are executed one after the other. A slot must finish before the next signal is handled. The Qt event loop manages the queue of signal / slot connections.

    When it's recommended use differents QObjects? when we need different programs or when?
    What problem are you trying to solve?
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Sep 2016
    Posts
    78
    Thanked 1 Time in 1 Post
    Qt products
    Qt5

    Default Re: Question about signal and slots

    i am learning about hooks but i think they are very limited. because if i need to use different signals and one of this are busy with one hook. I need to do something to stop or if i dont do this i cant use the other signals.

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Question about signal and slots

    It does not matter if you use hooks, slots, or anything else - if any part of your program prevents the Qt event loop from running, your program will freeze. See Wysota's article here.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  5. #5
    Join Date
    Sep 2016
    Posts
    78
    Thanked 1 Time in 1 Post
    Qt products
    Qt5

    Default Re: Question about signal and slots

    Thx a lot for this i will check thx again.!
    Last edited by davinciomare; 5th October 2016 at 23:42.

  6. #6
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Question about signal and slots

    The Qt documentation explains it much more thoroughly.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  7. #7
    Join Date
    Sep 2016
    Posts
    78
    Thanked 1 Time in 1 Post
    Qt products
    Qt5

    Default Re: Question about signal and slots

    ok thx a lot i will check this
    Last edited by davinciomare; 6th October 2016 at 15:30.

Similar Threads

  1. One signal more slots
    By paolom in forum Qt Programming
    Replies: 7
    Last Post: 31st July 2012, 12:48
  2. Signal/Slots, Where can i use it?
    By Tio in forum Newbie
    Replies: 2
    Last Post: 25th May 2010, 02:36
  3. Signal and Slots
    By waynew in forum Newbie
    Replies: 3
    Last Post: 20th November 2009, 04:50
  4. signal and slots
    By vermarajeev in forum Qt Programming
    Replies: 4
    Last Post: 16th October 2007, 09:31
  5. Signal and slots
    By villy in forum Qt Programming
    Replies: 1
    Last Post: 12th January 2007, 11:10

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.