[Qt-interest] Using One Signal and Multiple Slots
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Thu Jan 28 17:59:38 CET 2010
Felix Werkmeister wrote on Thursday, January 28, 2010 5:13 PM:
> I implemented a thread with a signal that ist received by multiple
> other threads. Ist there an opportunity to let only some of the slots
> receive the signal?
The sender does - and by design should not - know about its receivers. It is a "fire and forget" situation.
And whoever connects to these signals is responsible itself what to do with this signal - or when to disconnect from it (temporarily): http://doc.trolltech.com/4.6/qobject.html#disconnect.
But from a sender's point of view the only choice you have is: you fire the signal, or you don't (so /no one/ will receive it - http://doc.trolltech.com/4.6/qobject.html#blockSignals).
So you have to put the "who receives when which signal"-logic into another part, typically the "Controller" of the MVC pattern.
Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list