mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
[UI] Let focusOut handle Tab completion acceptance
This commit is contained in:
parent
c9ce34a00a
commit
9011d9d4ca
1 changed files with 4 additions and 17 deletions
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue