Vordok
Vordok

Reputation: 330

PyQT QtCore.SIGNAL

Is there any list of the signals that can be use with PyQT4 or at least there is one that is the opposite of lostFocus()?

Upvotes: 1

Views: 1840

Answers (1)

amicitas
amicitas

Reputation: 13651

There is a QFocusEvent event generated by 'QWidget', but not a signal. There is however a convenient event handler that catches these events: focusInEvent.

You can add your own signal by reimplementing this handler. For example (not tested):

class MyWidget(QtGui.QWidget):

    focus_in = QtCore.pyqtSignal(int, name='focusIn')

    def focusInEvent(self, event):
        self.focus_in.emit()
        QtGui.QWidget.focusInEvent(self, event)

Now you get a focusIn signal.

Upvotes: 2

Related Questions