开发者

PyQT QtCore.SIGNAL

开发者 https://www.devze.com 2023-02-12 05:47 出处:网络
Is there any list of the signals 开发者_如何学Cthat can be use with PyQT4 or at least there is one that is the opposite of lostFocus()?There is a QFocusEvent event generated by \'QWidget\', but not a

Is there any list of the signals 开发者_如何学Cthat can be use with PyQT4 or at least there is one that is the opposite of lostFocus()?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消