[Qt-interest] Qt::AutoConnection fails

Stefan Bisplinghoff bisplinghoff at hia.rwth-aachen.de
Tue Apr 14 13:29:38 CEST 2009


Oliver.Knoll at comit.ch schrieb:
> So what you really want here is a *queued* connection, so the signals as sent by the worker thread are automagically synchronised by the Qt event queue and your slot in the SomeComponent is executed in the context of the "main" thread.

Yeah, that's what I want and don't get! :-)

I have done some experiments with the different connection types and the
 results are, that with AutoConnection and QueuedConnection the slot is
just not been called.
Only the explicit usage of DirectConnection yields the correct
behaviour, although the connection should have been direct anyway as you
stated before. The slot is then called in the worker thread context as
expected.

I debugged the emit statement and found that with AutoConnection and
QueuedConnection the slot is activated in queued mode (queued_activate
in qobject.cpp), but the condition

	if (c.argumentTypes == &DIRECT_CONNECTION_ONLY)

succeeds, so the slot is not called.

Using the DirectConnection statement is just a workaround, because
calling the slot in the worker thread context yields extensive
synchonisation code in all signal receiving components.

Regards,
 Stefan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5713 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090414/5e0dc0d2/attachment.bin 


More information about the Qt-interest-old mailing list