diff --git a/src/gui/search/searchjobwidget.cpp b/src/gui/search/searchjobwidget.cpp index 2d231a25b..8d1689bfa 100644 --- a/src/gui/search/searchjobwidget.cpp +++ b/src/gui/search/searchjobwidget.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -160,9 +161,6 @@ SearchJobWidget::SearchJobWidget(SearchHandler *searchHandler, QWidget *parent) connect(searchHandler, &SearchHandler::searchFailed, this, &SearchJobWidget::searchFailed); connect(this, &QObject::destroyed, searchHandler, &QObject::deleteLater); - QShortcut *enterHotkey = new QShortcut(Qt::Key_Return, m_ui->resultsBrowser, nullptr, nullptr, Qt::WidgetShortcut); - connect(enterHotkey, &QShortcut::activated, this, &SearchJobWidget::downloadTorrents); - setStatusTip(statusText(m_status)); } @@ -479,3 +477,15 @@ CachedSettingValue &SearchJobWidget::nameFil static CachedSettingValue setting("Search/FilteringMode", NameFilteringMode::OnlyNames); return setting; } + +void SearchJobWidget::keyPressEvent(QKeyEvent *event) +{ + switch (event->key()) { + case Qt::Key_Enter: + case Qt::Key_Return: + downloadTorrents(); + break; + default: + QWidget::keyPressEvent(event); + } +} diff --git a/src/gui/search/searchjobwidget.h b/src/gui/search/searchjobwidget.h index 9d71c9913..777db8737 100644 --- a/src/gui/search/searchjobwidget.h +++ b/src/gui/search/searchjobwidget.h @@ -90,6 +90,9 @@ signals: void resultsCountUpdated(); void statusChanged(); +protected: + void keyPressEvent(QKeyEvent *event) override; + private: void loadSettings(); void saveSettings() const;