[Qt-interest] AutoConnection and Threads

elizabeta petreska elizabeta.petreska at gmail.com
Tue Oct 25 09:44:35 CEST 2011


Hi,

The current documentation in qt 4.7.4 says the following for AutoConnection:

"(default) If the signal is emitted from a different thread than the
receiving object, the signal is queued, behaving as Qt::QueuedConnection.
Otherwise, the slot is invoked directly, behaving as Qt::DirectConnection.
The type of connection is determined when the signal is emitted. "

So I understand that  thread affinity of the sender is not important in the
resolution of an AutoConnection, the important thing in resolution is in
which thread the signal is emitted, right ?

So, I have sender object that is created in thread other than the main
thread, and a receiver object that is created in main thread, and they are
connected with AutoConnection. However, the sender emits the event in the
main thread, so the type of connection should be resolved to direct, and the
reciver slot should be invoked directly. However this is not the case, i.e
the AutoConnection is resolved as queued and the slot is executed next time
the main event loop gets control. Why is this ? Can someone explain this.

I see this behavior in Qt 4.7.4 and also in Qt 4.5
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20111025/f3eb5ca7/attachment.html 


More information about the Qt-interest-old mailing list