[PyQt] How can I verify if signal was really connected with handler ?

Mateusz Korniak mateusz at ant.gliwice.pl
Fri Feb 5 12:07:46 GMT 2010


Hi !
How can I verify if signal was really connected with handler ?
Seems I always get True from connect() call.


Example code:

from PyQt4.QtCore import QObject, SIGNAL, SLOT

from PyKDE4.khtml import KHTMLPart
from PyKDE4.kdeui import KApplication,  KMainWindow
from PyKDE4.kdecore import KAboutData, KCmdLineArgs,  ki18n

class KWin(KMainWindow): # 
http://api.kde.org/pykde-4.3-api/kdeui/KMainWindow.html
    def __init__(self,):
        KMainWindow.__init__(self)
        self.khtmlpart = KHTMLPart(self)
        res = self.khtmlpart.connect(self.khtmlpart, SIGNAL("canceled (const 
QString &)"),  self.handler)
        print "DEBUG: res1: %r" % (res, )
        res = self.khtmlpart.connect(self.khtmlpart, SIGNAL("non_existing_slot 
(const QString &)"),  self.handler)
        print "DEBUG: res2: %r" % (res, )

    def handler(self):
        pass
        

class KApp(KApplication):
    def __init__(self):
        KApplication.__init__(self)
        self.window = KWin()
        
        
kabout_data = KAboutData("kapp", "", ki18n("foo"),  "version" )

kcmdlineargs = KCmdLineArgs.init([""], kabout_data)
kapp = KApp()

TIA, regards,
-- 
Mateusz Korniak


More information about the PyQt mailing list