Commit a70c767b authored by Eike Ziller's avatar Eike Ziller

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/5252Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarLeandro T. C. Melo <leandro.melo@nokia.com>
parent 106473c4
......@@ -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) {
......
......@@ -62,6 +62,7 @@ public:
void writeSettings();
protected:
bool event(QEvent *event);
bool eventFilter(QObject *obj, QEvent *event);
private slots:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment