I have what would seem to be a fairly small problem. My application has a
main window that currently has the ability to spawn a number of Non-Modal
QWidgets in their own respective windows. I need to emit or catch a
signal that is produced whenever a particular QWidget in its own window gets
the focus. After looking at the documentation I can't seem to find a
particular signal that is emitted. Does anyone have an idea how to
accomplish this task?
Thanks
Brian
################################################
import sys
from PyQt4 import QtGui, QtCore
class TestWidget(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.setGeometry(300, 300, 250, 150)
self.setWindowTitle('Test Widget')
quit = QtGui.QPushButton('Close',
self)
quit.setGeometry(10, 10, 60, 35)
self.connect(quit,
QtCore.SIGNAL('clicked()'),
QtGui.qApp,
QtCore.SLOT('quit()'))
#Something like the following is
what I'd like to do#
self.connect(self.focusInEvent,QtCore.SIGNAL('triggered()'),self.focus_event)
def focus_event(self):
print "This window has focus!"
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
tw = TestWidget()
tw.show()
sys.exit(app.exec_())
_______________________________________________
PyQt mailing list [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt