Skip to content

Commit

Permalink
Merge #8129: Fix RPC console auto completer
Browse files Browse the repository at this point in the history
16698cb PR #7772 is not enough to fix the issue with QCompleter, use event filter instead of `connect` (UdjinM6)
  • Loading branch information
jonasschnelli committed Jun 2, 2016
2 parents 58725ba + 16698cb commit ee1533e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/qt/rpcconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,14 @@ bool RPCConsole::eventFilter(QObject* obj, QEvent *event)
return true;
}
break;
case Qt::Key_Return:
case Qt::Key_Enter:
// forward these events to lineEdit
if(obj == autoCompleter->popup()) {
QApplication::postEvent(ui->lineEdit, new QKeyEvent(*keyevt));
return true;
}
break;
default:
// Typing in messages widget brings focus to line edit, and redirects key there
// Exclude most combinations and keys that emit no text, except paste shortcuts
Expand Down Expand Up @@ -458,9 +466,7 @@ void RPCConsole::setClientModel(ClientModel *model)

autoCompleter = new QCompleter(wordList, this);
ui->lineEdit->setCompleter(autoCompleter);

// clear the lineEdit after activating from QCompleter
connect(autoCompleter, SIGNAL(activated(const QString&)), ui->lineEdit, SLOT(clear()), Qt::QueuedConnection);
autoCompleter->popup()->installEventFilter(this);
}
}

Expand Down

0 comments on commit ee1533e

Please sign in to comment.