[Qt-interest] Forcing a signal "emit" to be queued
Thiago Macieira
thiago at kde.org
Mon Mar 21 08:07:03 CET 2011
On Monday, 21 de March de 2011 12:00:03 Mandeep Sandhu wrote:
> Hi All,
>
> Sometime back I had a requirement where I didn't want ppl using my
> class's signals to connect to them directly. Currently if you do 'emit
> mySignal()', it's upto to the class that uses this signal, to decide
> how it would like to connect to it.
>
> For forcing a queued a connection, I thought of the following approach:
>
> connect(this, SIGNAL(myInternalSignal(), this, SIGNAL(mySignal()),
> Qt::QueuedConnection);
>
> Basically I'm chaining my signal and re-emitting it with the queued
> connection type (I've yet to verify this code though).
>
> How can one verify if the slot is indeed called in a queued connection?
Well, there's no SLOT above. The above makes the signal-signal connection be
queued. It's clear from the code.
If anything is connected to the signal mySignal(), then it will be delivered
through standard mechanisms when mySignal itself is invoked.
In other words, when compared to myInternalSignal(), the slots are either
queued or doubly queued.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Senior Product Manager - Nokia, Qt Development Frameworks
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110321/b81b7156/attachment.bin
More information about the Qt-interest-old
mailing list