[PyQt] disconnectNotify never called

Phil Thompson phil at riverbankcomputing.co.uk
Sat Jan 12 17:25:15 GMT 2008


On Saturday 12 January 2008, Laurent Hamery wrote:
> Hi guys,
> It seems - for me - as a bug but the virtual method disconnectNotify()
> is never called. And perhaps the connectNotify is called in place of it.
> So .. did I miss something ?
> Im using PyQt 4.2 and python2.4.3 but I cant test with the latest version.
>
> Cheers
> Laurent
>
>
>
>
> #!/usr/bin/env python2.4.3
>
> # Author : Laurent Hamery 2007 @ laurent-h
>
> import sys
>
> from PyQt4.QtGui  import *
> from PyQt4.QtCore import *
>
> def connectionTest():
> 	pass
>
> ###########################################################################
>############### # Disconnection test class
> ###########################################################################
>###############
>
> class DisconnectTest(QPushButton):
> 	def __init__(self, parent=None):
> 		QPushButton.__init__(self, parent)
>
> 		if self.connect(self, SIGNAL('clicked'), connectionTest):
> 			print 'connection ok'
> 		if self.disconnect(self, SIGNAL('clicked'), connectionTest):
> 			print 'disconnection ok'
>
> 	def connectNotify(self, signal):
> 		print 'connectNotify'
>
> 	def disconnectNotify(self, signal):
> 		print 'disconnectNotify'
>
> if __name__ == '__main__':
> 	app = QApplication(sys.argv)
> 	test = DisconnectTest()
> 	test.show()
> 	app.exec_()
> 	del test

disconnectNotify() isn't called for Python signals (maybe it should). Did you 
mean 'clicked()' instead of 'clicked'?

Phil


More information about the PyQt mailing list