summaryrefslogtreecommitdiff
path: root/src/plugins/find
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@nokia.com>2011-09-20 17:23:05 +0200
committerEike Ziller <eike.ziller@nokia.com>2011-09-21 15:12:41 +0200
commita70c767b929c916e8e21aec08d2933f4fede6b0f (patch)
treee2782e19017c075c6830c65d2a2a4a187e539843 /src/plugins/find
parent106473c4b5da0dfef3f79b8fa4b50e89b2c07cb4 (diff)
downloadqt-creator-a70c767b929c916e8e21aec08d2933f4fede6b0f.tar.gz
Fixes: Pressing return in search panel didn't run the search.
It did so only if the focus was on the search term line edit. Task-number: QTCREATORBUG-6114 Change-Id: I0cf051ed0f5f4e7403d7c36eb2173a71de370276 Reviewed-on: http://codereview.qt-project.org/5252 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
Diffstat (limited to 'src/plugins/find')
-rw-r--r--src/plugins/find/findtoolwindow.cpp15
-rw-r--r--src/plugins/find/findtoolwindow.h1
2 files changed, 15 insertions, 1 deletions
diff --git a/src/plugins/find/findtoolwindow.cpp b/src/plugins/find/findtoolwindow.cpp
index 4fc75c9630..93b233f311 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<QKeyEvent *>(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 ba9d0e881c..41d5693e24 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: