pyqt pyside QLineEdit 重写键盘事件

pyqt pyside QLineEdit 重写键盘事件

def keyPressEvent(self, event):
    if (event.modifiers() & QtCore.Qt.ShiftModifier):
        self.shift = True
        print 'Shift!'
    # call base class keyPressEvent
    QtGui.QLineEdit.keyPressEvent(self, event)


https://stackoverflow.com/questions/5047558/properly-handling-a-keypressevent-in-a-subclassed-pyqt-lineedit
posted @ 2019-03-26 15:01  ibingshan  阅读(1567)  评论(0编辑  收藏  举报