Skip to content

Commit

Permalink
Search: merge Enter/Return key handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Feb 17, 2022
1 parent d689a1f commit 2b21769
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/widget/wsearchlineedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,6 @@ WSearchLineEdit::WSearchLineEdit(QWidget* pParent, UserSettingsPointer pConfig)
this,
&WSearchLineEdit::slotIndexChanged);

// When you hit enter, it will trigger or clear the search.
connect(this->lineEdit(),
&QLineEdit::returnPressed,
this,
[this] {
if (!slotClearSearchIfClearButtonHasFocus()) {
slotTriggerSearch();
}
});
loadQueriesFromConfig();

refreshState();
Expand Down Expand Up @@ -352,6 +343,10 @@ void WSearchLineEdit::keyPressEvent(QKeyEvent* keyEvent) {
}
break;
case Qt::Key_Enter:
case Qt::Key_Return:
if (slotClearSearchIfClearButtonHasFocus()) {
return;
}
if (findCurrentTextIndex() == -1) {
slotSaveSearch();
}
Expand Down

0 comments on commit 2b21769

Please sign in to comment.