Commit 225a827b authored by con's avatar con
Browse files

Let search dialog open the completion box at cursor down.

Similar to what we do in the find tool bar.

Task-number: QTCREATORBUG-1543
parent 1ce66f8d
......@@ -36,6 +36,7 @@
#include <QtGui/QMainWindow>
#include <QtGui/QStringListModel>
#include <QtGui/QCompleter>
#include <QtGui/QKeyEvent>
using namespace Find;
using namespace Find::Internal;
......@@ -56,6 +57,7 @@ FindToolWindow::FindToolWindow(FindPlugin *plugin)
connect(m_ui.searchTerm, SIGNAL(textChanged(QString)), this, SLOT(updateButtonStates()));
m_findCompleter->setModel(m_plugin->findCompletionModel());
m_ui.searchTerm->setCompleter(m_findCompleter);
m_ui.searchTerm->installEventFilter(this);
QVBoxLayout *layout = new QVBoxLayout;
layout->setMargin(0);
layout->setSpacing(0);
......@@ -68,6 +70,17 @@ FindToolWindow::~FindToolWindow()
qDeleteAll(m_configWidgets);
}
bool FindToolWindow::eventFilter(QObject *obj, QEvent *event)
{
if (obj == m_ui.searchTerm && event->type() == QEvent::KeyPress) {
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
if (ke->key() == Qt::Key_Down) {
m_findCompleter->complete();
}
}
return QDialog::eventFilter(obj, event);
}
void FindToolWindow::updateButtonStates()
{
bool enabled = !m_ui.searchTerm->text().isEmpty()
......
......@@ -57,6 +57,9 @@ public:
void readSettings();
void writeSettings();
protected:
bool eventFilter(QObject *obj, QEvent *event);
private slots:
void search();
void replace();
......
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