I'm trying to get key input and filter in pyqt5 ui, but it's not detecting keypress, only getting 74 and 75 event.
class Ui(QMainWindow):
def eventFilter(self, obj, event):
# only returned 74 = 6 ? and 75 = 6 ?
print("{} = {} ?".format(event.type(), QtCore.QEvent.KeyPress))
if event.type() == QtCore.QEvent.KeyPress:
print("key pressed!")
return super(Ui, self).eventFilter(obj, event)
# main
if __name__ == "__main__":
app = QApplication(sys.argv)
window = Ui(0.1)
window.installEventFilter(window) # install filter
app.exec_()