Skip to content

Commit

Permalink
Add ability to serach previous with Shift+Enter in the search toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkanovikov committed Oct 6, 2024
1 parent d0e79cf commit 728a8b7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/corelib/ui/modules/search_toolbar/search_toolbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,11 @@ void SearchToolbar::setReadOnly(bool _readOnly)

void SearchToolbar::refocus()
{
d->searchText->setFocus();
if (d->replaceText->hasFocus()) {
d->replaceText->setFocus();
} else {
d->searchText->setFocus();
}
}

QString SearchToolbar::searchText() const
Expand Down Expand Up @@ -260,7 +264,11 @@ bool SearchToolbar::eventFilter(QObject* _watched, QEvent* _event)
if ((keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return)
&& !d->searchText->text().isEmpty()) {
if (_watched == d->searchText) {
emit findTextRequested();
if (keyEvent->modifiers().testFlag(Qt::ShiftModifier)) {
emit findPreviousRequested();
} else {
emit findTextRequested();
}
} else if (_watched == d->replaceText) {
emit replaceOnePressed();
}
Expand Down

0 comments on commit 728a8b7

Please sign in to comment.