[PyQt] A simple question about signals and slots
David Boddie
david at boddie.org.uk
Sat Sep 5 02:16:51 BST 2009
On Sat Sep 5 01:42:59 BST 2009, William wrote:
> But, if I generate an EVENT (sorry for the language sloppiness earlier) B,
> it will go up to A and disappear, unless I propagate it down to the leaves
> (which could be dangerous). So, the question is, whether or not there's a
> common bus/dispatcher in which B can put some information and whoever wants
> to be triggered by it, can?
It sounds like you want some kind of registration and notification system.
C requests to receive a certain kind of message, and B sends that kind of
message. In this system, A could play the role of broker without needing
to explictly connect a signal B to a slot in C.
With a direct signal-slot connection between B and C, neither needs to know
about the other, but the issue is more about A having access to both of them.
With some kind of broker system, you could connect a signal from B to a
signal in A, and connect the signal in A to a slot in C at a different time.
Alternatively, you could have a separate object that redirects signals from
arbitrary objects to other arbitrary objects. None of the objects have to
know about each other; they just have to have access to this object.
There's probably a name for this kind of system.
David
More information about the PyQt
mailing list