forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user