<table cellspacing='0' cellpadding='0' border='0' background='none' style='font-family:arial;font-size:10pt;color:rgb(51, 51, 51);background-color:rgb(255, 255, 255);width:100%;'><tr><td valign='top' style='font: inherit;'><span style="font-family: monospace;">I have what would seem to be a fairly small problem.&nbsp; My application has a main window that currently has the ability to spawn a number of Non-Modal QWidgets in their own respective windows.&nbsp; I need to emit or catch a signal that is produced whenever a particular QWidget in its own window gets the focus.&nbsp; After looking at the documentation I can't seem to find a particular signal that is emitted.&nbsp; Does anyone have an idea how to </span>accomplish this task?<br><br>Thanks<br><br>Brian<br>################################################<br><br>import sys<br>from PyQt4 import QtGui, QtCore<br><br><br>class TestWidget(QtGui.QWidget):<br>&nbsp;&nbsp;&nbsp; def __init__(self,
 parent=None):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; QtGui.QWidget.__init__(self, parent)<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.setGeometry(300, 300, 250, 150)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.setWindowTitle('Test Widget')<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; quit = QtGui.QPushButton('Close', self)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; quit.setGeometry(10, 10, 60, 35)<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.connect(quit, QtCore.SIGNAL('clicked()'),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; QtGui.qApp, QtCore.SLOT('quit()'))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #Something like the following is what I'd like to do#<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.connect(self.focusInEvent,QtCore.SIGNAL('triggered()'),self.focus_event)<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; def
 focus_event(self):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print "This window has focus!"<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp; <br>if __name__ == "__main__":<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; app = QtGui.QApplication(sys.argv)<br>&nbsp;&nbsp;&nbsp; tw = TestWidget()<br>&nbsp;&nbsp;&nbsp; tw.show()<br>&nbsp;&nbsp;&nbsp; sys.exit(app.exec_())<br></td></tr></table><br>