[PyQt] the mechanism behind qt signal and slot

Algis Kabaila akabaila at pcug.org.au
Sun Sep 19 11:58:56 BST 2010


On Sunday 19 September 2010 19:54:54 Andreas Pakulat wrote:

> > Ch 10 does not talk about Signals-Slots directly, but it tells the
> > details about the lower level events.  It is the same and one mechanism
> > as Signals- Slots, it is just that it is looked  at from a different
> > perspective. I think that usually the "signal" is caught by the "slot"
> > and acted on it as required. OTH, if the signal is not caught by a
> > "slot" it travels up the widget tree to the very top level widget and if
> > it is not caught there, it is simply dropped (ignored).
> 
> No thats completely wrong. Signal/Slots are a direct connection between
> emitter and receiver, there's no propagation 'upwards'. In fact most of
> the time its a direct function call from the signal-function into the
> slot.
> 
> It all works (at least on the pure-Qt level) through the
> meta-object-code generated by moc. That one generates the code for the
> signal-functions which use the Metaobject system to find all the slots
> connected to the signal and call the slots directly.
>
 
That's true, but what happens if the slot does not handle the signal? Why it 
may not handle it, I have no idea.  May be a programming mistake or whatever. 
I seem to recall statement that if the signal is NOT handled, then the signal 
propagates in the tree up to the root. So whilst I bow to your very much 
better understanding and much wider and deeper knowledge of PyQt, it seems to 
me that we are talking about two different situations, proverbially comparing 
apples and oranges.

Anyway, I am pleased that you are pointing out what may well be another error 
by me - thank you. 

I recall you helping me some years back.  I know it was very effective help and 
I was much stronger and not in such an advanced aging state.

Kind regards and thank you again,

Al.

> Thats all the Qt-level of signal/slots, I don't know how Phil
> implemented the new-style-signal/slots but they also don't propagate
> upwards in the widget-hierarchy.
> 
> Andreas

-- 
OldAl
akabaila at pcug.org.au


More information about the PyQt mailing list