mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
[UI] Accept current completion when no item selected in popup
This commit is contained in:
parent
1836160538
commit
66efebe87a
1 changed files with 7 additions and 1 deletions
|
|
@ -88,8 +88,14 @@ void LineEditCompleter::keyPressEvent(QKeyEvent *event)
|
|||
if (info.completer->popup()->isVisible()) {
|
||||
event->ignore();
|
||||
const QModelIndex currentIndex = info.completer->popup()->currentIndex();
|
||||
QString completionText;
|
||||
if (currentIndex.isValid()) {
|
||||
insertCompletion(info.completer, currentIndex.data().toString());
|
||||
completionText = currentIndex.data().toString();
|
||||
} else {
|
||||
completionText = info.completer->currentCompletion();
|
||||
}
|
||||
if (!completionText.isEmpty()) {
|
||||
insertCompletion(info.completer, completionText);
|
||||
}
|
||||
hideCompleterPopups();
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue