Skip to content

Commit 16698cb

Browse files
committed
PR bitcoin#7772 is not enough to fix the issue with QCompleter, use event filter instead of connect
1 parent 950be19 commit 16698cb

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/qt/rpcconsole.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,14 @@ bool RPCConsole::eventFilter(QObject* obj, QEvent *event)
327327
return true;
328328
}
329329
break;
330+
case Qt::Key_Return:
331+
case Qt::Key_Enter:
332+
// forward these events to lineEdit
333+
if(obj == autoCompleter->popup()) {
334+
QApplication::postEvent(ui->lineEdit, new QKeyEvent(*keyevt));
335+
return true;
336+
}
337+
break;
330338
default:
331339
// Typing in messages widget brings focus to line edit, and redirects key there
332340
// Exclude most combinations and keys that emit no text, except paste shortcuts
@@ -458,9 +466,7 @@ void RPCConsole::setClientModel(ClientModel *model)
458466

459467
autoCompleter = new QCompleter(wordList, this);
460468
ui->lineEdit->setCompleter(autoCompleter);
461-
462-
// clear the lineEdit after activating from QCompleter
463-
connect(autoCompleter, SIGNAL(activated(const QString&)), ui->lineEdit, SLOT(clear()), Qt::QueuedConnection);
469+
autoCompleter->popup()->installEventFilter(this);
464470
}
465471
}
466472

0 commit comments

Comments
 (0)