[UI] Let focusOut handle Tab completion acceptance

This commit is contained in:
Lukas Brübach 2026-10-09 13:00:42 +02:00
parent c9ce34a00a
commit 9011d9d4ca

View file

@ -114,24 +114,11 @@ void LineEditCompleter::keyPressEvent(QKeyEvent *event)
} }
if (event->key() == Qt::Key_Tab) { if (event->key() == Qt::Key_Tab) {
for (auto &info : completers) { bool popupVisible = hasVisibleCompleterPopup();
if (info.completer->popup()->isVisible()) { if (popupVisible) {
event->ignore(); event->ignore();
const QModelIndex currentIndex = info.completer->popup()->currentIndex(); return;
QString completionText;
if (currentIndex.isValid()) {
completionText = currentIndex.data().toString();
} else {
completionText = info.completer->currentCompletion();
}
if (!completionText.isEmpty()) {
insertCompletion(info.completer, completionText);
}
hideCompleterPopups();
return;
}
} }
// If no popup is visible, prevent Tab from moving focus
event->ignore(); event->ignore();
return; return;
} }