diff --git a/src/plugins/find/findtoolwindow.cpp b/src/plugins/find/findtoolwindow.cpp index 4fc75c96302..93b233f3110 100644 --- a/src/plugins/find/findtoolwindow.cpp +++ b/src/plugins/find/findtoolwindow.cpp @@ -64,7 +64,6 @@ FindToolWindow::FindToolWindow(FindPlugin *plugin, QWidget *parent) connect(m_ui.regExp, SIGNAL(toggled(bool)), m_plugin, SLOT(setRegularExpression(bool))); connect(m_ui.filterList, SIGNAL(activated(int)), this, SLOT(setCurrentFilter(int))); connect(m_ui.searchTerm, SIGNAL(textChanged(QString)), this, SLOT(updateButtonStates())); - connect(m_ui.searchTerm, SIGNAL(returnPressed()), this, SLOT(search())); m_findCompleter->setModel(m_plugin->findCompletionModel()); m_ui.searchTerm->setCompleter(m_findCompleter); @@ -86,6 +85,20 @@ FindToolWindow *FindToolWindow::instance() return m_instance; } +bool FindToolWindow::event(QEvent *event) +{ + if (event->type() == QEvent::KeyPress) { + QKeyEvent *ke = static_cast(event); + if ((ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Enter) + && ke->modifiers() == Qt::NoModifier) { + ke->accept(); + search(); + return true; + } + } + return QWidget::event(event); +} + bool FindToolWindow::eventFilter(QObject *obj, QEvent *event) { if (obj == m_ui.searchTerm && event->type() == QEvent::KeyPress) { diff --git a/src/plugins/find/findtoolwindow.h b/src/plugins/find/findtoolwindow.h index ba9d0e881c4..41d5693e242 100644 --- a/src/plugins/find/findtoolwindow.h +++ b/src/plugins/find/findtoolwindow.h @@ -62,6 +62,7 @@ public: void writeSettings(); protected: + bool event(QEvent *event); bool eventFilter(QObject *obj, QEvent *event); private slots: