[PyKDE] SIGNAL-to-SIGNAL connection seems broken

Phil Thompson phil at riverbankcomputing.co.uk
Sun Feb 18 17:13:46 GMT 2007


On Wednesday 24 January 2007 11:43 pm, Giovanni Bajo wrote:
> Hi Phil,
>
> ==============================================
> #!/usr/bin/env python
> from PyQt4.Qt import *
>
> a = QObject(None)
>
> called = []
> def myslot():
>      called.append(True)
>
> QObject.connect(a, SIGNAL("destroyed()"), a, SIGNAL("QUIT"))
> QObject.connect(a, SIGNAL("destroyed()"), myslot)
> QObject.connect(a, SIGNAL("QUIT"), myslot)
>
> del a
> assert len(called) == 2, len(called)
> ==============================================
>
> This fails for me with PyQt 4.1.1 and SIP-snapshot-20061220 (the slot is
> invoked only once). I didn't test with newer SIP snapshots though.

You need to add parenthesis to QUIT as you cannot connect Qt signals to 
short-circuit signals - connect() returns False.

However there is a bug/feature that is fixed in tonight's PyQt snapshot.

Phil




More information about the PyQt mailing list