diff --git a/flanarunas/my_qt/combo_boxes.py b/flanarunas/my_qt/combo_boxes.py index f07ba32..156bc04 100644 --- a/flanarunas/my_qt/combo_boxes.py +++ b/flanarunas/my_qt/combo_boxes.py @@ -25,6 +25,7 @@ def __init__(self, parent=None, items=None): self.lineEdit().textEdited.connect(self._set_completer_items) self.lineEdit().returnPressed.disconnect() # no add new elements at enter + self.completer.popup().activated.connect(lambda x: print(1, x)) def add_item(self, item: str): self.items += [item] @@ -34,9 +35,10 @@ def delete_item(self, name: str): self.items = self._items def event(self, event: QtCore.QEvent) -> bool: - if isinstance(event, QtGui.QKeyEvent) and event.key() == QtCore.Qt.Key_Tab: + if isinstance(event, QtGui.QKeyEvent) and event.key() == QtCore.Qt.Key_Tab and event.type() == QtCore.QEvent.KeyPress: # noinspection PyUnresolvedReferences - self.completer.activated.emit(self.completer.currentCompletion()) + self.completer.activated.emit(self.completer.popup().model().data(self.completer.popup().currentIndex())) + self.setFocus() return super().event(event) diff --git a/flanarunas/resources/data.json b/flanarunas/resources/data.json index 9e26dfe..0967ef4 100644 --- a/flanarunas/resources/data.json +++ b/flanarunas/resources/data.json @@ -1 +1 @@ -{} \ No newline at end of file +{}