From 0ab9273a25eeaa0593cf69cfdda14cabf6e7ccbf Mon Sep 17 00:00:00 2001 From: Jani Mustonen Date: Thu, 2 Nov 2017 20:53:28 +0200 Subject: [PATCH] Implement #114 --- src/QuickSwitcher.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/QuickSwitcher.cc b/src/QuickSwitcher.cc index 542eebd9..2be636a4 100644 --- a/src/QuickSwitcher.cc +++ b/src/QuickSwitcher.cc @@ -122,7 +122,16 @@ QuickSwitcher::QuickSwitcher(QWidget *parent) roomSearch_, &RoomSearchInput::hiding, this, [=]() { completer_->popup()->hide(); }); connect(roomSearch_, &QLineEdit::returnPressed, this, [=]() { emit closing(); - emit roomSelected(rooms_[this->roomSearch_->text().trimmed()]); + + QString text(""); + + if (selection_ == -1) { + completer_->setCurrentRow(0); + text = completer_->currentCompletion(); + } else { + text = this->roomSearch_->text().trimmed(); + } + emit roomSelected(rooms_[text]); roomSearch_->clear(); });