mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-09 03:23:24 -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()) {
|
if (info.completer->popup()->isVisible()) {
|
||||||
event->ignore();
|
event->ignore();
|
||||||
const QModelIndex currentIndex = info.completer->popup()->currentIndex();
|
const QModelIndex currentIndex = info.completer->popup()->currentIndex();
|
||||||
|
QString completionText;
|
||||||
if (currentIndex.isValid()) {
|
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();
|
hideCompleterPopups();
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue