[PyQt] signal/slot vs Qt.UniqueConnection ?

Phil Thompson phil at riverbankcomputing.com
Fri Apr 8 13:40:44 BST 2011

On Thu, 07 Apr 2011 12:49:43 +0200, Zoltan Szalai <defaultdict at gmail.com>
> Hi,
> I'm quite sure I'm missing something fundamental here but I can't get 
> QObject.connect to work as expected when using Qt.UniqueConnection as a 
> connection type.
> I attached some code that demonstrates my problem. I would expect that 
> the slot is called only once.
> versions:
> PyQt4: 4.8.3
> Qt: 4.7.0
> sip: 4.12.1
> python: 2.6.5
> thx
> Zoli

PyQt creates a proxy when a slot is not a Qt slot (ie. not a QObject
method decorated with pyqtSlot). A new proxy is created for each connection
so, as far as Qt is concerned, the connections in your example are not

If you convert your slot, ie. so that it is a method of A and decorated
with pyqtSlot, then the second call to connect() will fail.


More information about the PyQt mailing list