From 9011d9d4cafdb0aa8bab74fc85bc6c40237fbf86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Fri, 9 Oct 2026 13:00:42 +0200 Subject: [PATCH] [UI] Let focusOut handle Tab completion acceptance --- .../widgets/utility/line_edit_completer.cpp | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/cockatrice/src/interface/widgets/utility/line_edit_completer.cpp b/cockatrice/src/interface/widgets/utility/line_edit_completer.cpp index 8adeabc3e..a1789fe99 100644 --- a/cockatrice/src/interface/widgets/utility/line_edit_completer.cpp +++ b/cockatrice/src/interface/widgets/utility/line_edit_completer.cpp @@ -114,24 +114,11 @@ void LineEditCompleter::keyPressEvent(QKeyEvent *event) } if (event->key() == Qt::Key_Tab) { - for (auto &info : completers) { - if (info.completer->popup()->isVisible()) { - event->ignore(); - const QModelIndex currentIndex = info.completer->popup()->currentIndex(); - QString completionText; - if (currentIndex.isValid()) { - completionText = currentIndex.data().toString(); - } else { - completionText = info.completer->currentCompletion(); - } - if (!completionText.isEmpty()) { - insertCompletion(info.completer, completionText); - } - hideCompleterPopups(); - return; - } + bool popupVisible = hasVisibleCompleterPopup(); + if (popupVisible) { + event->ignore(); + return; } - // If no popup is visible, prevent Tab from moving focus event->ignore(); return; }