Skip to content
Snippets Groups Projects
Commit 240a6ec5 authored by con's avatar con
Browse files

Fixes locator's show method in case the filter already has focus.


Was making the "f" filter unusable, because the popup was hidden when
selecting a directory.

Reviewed-by: default avatardt <qtc-committer@nokia.com>
parent 4505d92b
No related branches found
No related tags found
No related merge requests found
...@@ -296,7 +296,7 @@ QuickOpenToolWindow::QuickOpenToolWindow(QuickOpenPlugin *qop) : ...@@ -296,7 +296,7 @@ QuickOpenToolWindow::QuickOpenToolWindow(QuickOpenPlugin *qop) :
connect(m_refreshAction, SIGNAL(triggered()), m_quickOpenPlugin, SLOT(refresh())); connect(m_refreshAction, SIGNAL(triggered()), m_quickOpenPlugin, SLOT(refresh()));
connect(m_configureAction, SIGNAL(triggered()), this, SLOT(showConfigureDialog())); connect(m_configureAction, SIGNAL(triggered()), this, SLOT(showConfigureDialog()));
connect(m_fileLineEdit, SIGNAL(textEdited(const QString&)), connect(m_fileLineEdit, SIGNAL(textEdited(const QString&)),
this, SLOT(textEdited(const QString&))); this, SLOT(showPopup()));
connect(m_completionList, SIGNAL(activated(QModelIndex)), connect(m_completionList, SIGNAL(activated(QModelIndex)),
this, SLOT(acceptCurrentEntry())); this, SLOT(acceptCurrentEntry()));
} }
...@@ -347,8 +347,7 @@ bool QuickOpenToolWindow::eventFilter(QObject *obj, QEvent *event) ...@@ -347,8 +347,7 @@ bool QuickOpenToolWindow::eventFilter(QObject *obj, QEvent *event)
} else if (obj == m_fileLineEdit && event->type() == QEvent::FocusIn) { } else if (obj == m_fileLineEdit && event->type() == QEvent::FocusIn) {
if (static_cast<QFocusEvent*>(event)->reason() != Qt::MouseFocusReason) if (static_cast<QFocusEvent*>(event)->reason() != Qt::MouseFocusReason)
m_fileLineEdit->selectAll(); m_fileLineEdit->selectAll();
updateCompletionList(m_fileLineEdit->typedText()); showPopup();
showCompletionList();
} else if (obj == this && event->type() == QEvent::ShortcutOverride) { } else if (obj == this && event->type() == QEvent::ShortcutOverride) {
QKeyEvent *ke = static_cast<QKeyEvent *>(event); QKeyEvent *ke = static_cast<QKeyEvent *>(event);
if (ke->key() == Qt::Key_Escape && !ke->modifiers()) { if (ke->key() == Qt::Key_Escape && !ke->modifiers()) {
...@@ -369,9 +368,9 @@ void QuickOpenToolWindow::showCompletionList() ...@@ -369,9 +368,9 @@ void QuickOpenToolWindow::showCompletionList()
m_completionList->show(); m_completionList->show();
} }
void QuickOpenToolWindow::textEdited(const QString &text) void QuickOpenToolWindow::showPopup()
{ {
updateCompletionList(text); updateCompletionList(m_fileLineEdit->typedText());
showCompletionList(); showCompletionList();
} }
...@@ -440,7 +439,11 @@ void QuickOpenToolWindow::show(const QString &text, int selectionStart, int sele ...@@ -440,7 +439,11 @@ void QuickOpenToolWindow::show(const QString &text, int selectionStart, int sele
{ {
m_fileLineEdit->hideHintText(); m_fileLineEdit->hideHintText();
m_fileLineEdit->setText(text); m_fileLineEdit->setText(text);
setFocus(); if (!m_fileLineEdit->hasFocus())
m_fileLineEdit->setFocus();
else
showPopup();
if (selectionStart >= 0) if (selectionStart >= 0)
m_fileLineEdit->setSelection(selectionStart, selectionLength); m_fileLineEdit->setSelection(selectionStart, selectionLength);
else else
......
...@@ -67,7 +67,7 @@ public: ...@@ -67,7 +67,7 @@ public:
void show(const QString &text, int selectionStart = -1, int selectionLength = 0); void show(const QString &text, int selectionStart = -1, int selectionLength = 0);
private slots: private slots:
void textEdited(const QString &text); void showPopup();
void acceptCurrentEntry(); void acceptCurrentEntry();
void filterSelected(); void filterSelected();
void showConfigureDialog(); void showConfigureDialog();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment