[PyKDE] Static member functions
    Diez B. Roggisch 
    deets at web.de
       
    Tue Dec 14 15:50:41 GMT 2004
    
    
  
Hi,
I think I understand your problem as follows: You have a non-parametrized 
signal, lostFocus, that you want to connect to one slot - but then somehow 
"magically" there shall be a reference to the object the signal came from is 
passed.
May be what could help is somthing like this:
class Magic(QObject):
     def __init__(self, dialog, key):
        QObject.__init__(self)
        self.dialog = dialog
        self.key = key
    def focusLost(self):
          self.dialog.keyLostFocus(self.key)
Now you connect your signals in a loop like this:
for key in keys:
     self.connect(key, SIGNAL("focusLost()"), Magic(self, key).focusLost)
That assumes that self is the dialog and keys the list of key-widgets.
HTH,
Diez
    
    
More information about the PyQt
mailing list