def keyPressEvent(self, event): """Handle key press events""" if event.key() == Qt.Key_Return or event.key() == Qt.Key_Enter: if self.add_current_text_if_valid(): self.selected() else: QComboBox.keyPressEvent(self, event)
def keyPressEvent(self, event): """Handle key press events""" if event.key() == Qt.Key_Return or event.key() == Qt.Key_Enter: if self.add_current_text_if_valid(): self.selected() else: QComboBox.keyPressEvent(self, event)
def keyPressEvent(self, event): """Handle key press events""" if event.key() == Qt.Key_Return or event.key() == Qt.Key_Enter: valid = self.is_valid(self.currentText()) if valid or valid is None: self.add_current_text() else: QComboBox.keyPressEvent(self, event)
def keyPressEvent(self, event): """Qt Override. Handle key press events. """ if event.key() == Qt.Key_Return or event.key() == Qt.Key_Enter: if self.add_current_text_if_valid(): self.selected() self.hide_completer() elif event.key() == Qt.Key_Escape: self.set_current_text(self.selected_text) self.hide_completer() else: QComboBox.keyPressEvent(self, event)