[PyQt] disconnect all slots in QObject

oliver oliver.schoenborn at gmail.com
Fri Nov 11 00:06:17 GMT 2016


The Qt docs at http://doc.qt.io/qt-5/qobject.html#disconnect-2 suggest that
it is possible to disconnect all signals of an emitter from all slots of a
specific receiver (because the method name can be null). In Python, the
following should therefore work, but it doesn't:

from PyQt5.QtCore import QObject, pyqtSignal

class Foo(QObject):
    def slot1(self):
        print('slot1')

class Emitter(QObject):
    sig_test = pyqtSignal()

foo = Foo()
emitter = Emitter()
con = emitter.sig_test.connect(foo.slot1)
emitter.disconnect(foo)  # TypeError: too many arguments

QObject.disconnect() takes no arguments. Is the equivalent functionality
somewhere else in PyQt? Also, the C++ docs indicate that connecting a
signal to a slot returns a QMetaObject::Connection object; nothing is
returned from connect(), so same question there.

Thanks,
Oliver
-- 
Oliver
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20161111/346c6650/attachment.html>


More information about the PyQt mailing list