Qt 4.5 - Is emitting signal a function call, or a thread, and does it blocks?

后端 未结 3 1757
再見小時候
再見小時候 2021-01-31 03:03

I am not sure about the nature of the signal/slot mechanism in Qt 4.5. When a signal is emitted, is it a blocking function call or a thread? Say this

emit GrabLa         


        
3条回答
  •  执笔经年
    2021-01-31 03:36

    laalto's answer above is correct. One further point though: if all of your QObjects belong to the same thread and you haven't manually specified queued connections, then the execution of slots connected to the signal occurs synchronously - all processing will be done before the next line after the 'emit' statement. Since this is the most common case, the answer to your question is normally 'yes'.

    The documentation on signals and slots across multiple threads may be helpful to you.

提交回复
热议问题