def keyPressEvent(self, event: QKeyEvent): if event.key() == Qt.Key_Enter: event.ignore() else: event.accept()