diff options
author | con <[email protected]> | 2010-03-10 11:44:09 +0100 |
---|---|---|
committer | con <[email protected]> | 2010-03-10 14:32:34 +0100 |
commit | 99929ac9b9f6709a0ed3f3df72b9f834edcad55f (patch) | |
tree | be0e8fde4cdfde2cca4d13cdbd6888437cc40e46 /src/plugins/find/findtoolbar.cpp | |
parent | 171cb415dca9a68060a41c9c9c4ef704a6e4af14 (diff) |
Avoid a flickering popup at startup and save some time on startup.
QCompleter::popup() actually shows the popup, which is both annoying and slow.
Delay the annoyance from startup to a later point till this is fixed in
Qt.
Diffstat (limited to 'src/plugins/find/findtoolbar.cpp')
-rw-r--r-- | src/plugins/find/findtoolbar.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/plugins/find/findtoolbar.cpp b/src/plugins/find/findtoolbar.cpp index 3b153ae316f..ed359fdc5cd 100644 --- a/src/plugins/find/findtoolbar.cpp +++ b/src/plugins/find/findtoolbar.cpp @@ -71,7 +71,8 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen m_regexpIcon(":/find/images/regexp.png"), m_wholewordsIcon(":/find/images/wholewords.png"), m_findIncrementalTimer(this), m_findStepTimer(this), - m_useFakeVim(false) + m_useFakeVim(false), + m_eventFiltersInstalled(false) { //setup ui m_ui.setupUi(this); @@ -89,17 +90,12 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen m_findCompleter->setModel(m_plugin->findCompletionModel()); m_replaceCompleter->setModel(m_plugin->replaceCompletionModel()); m_ui.findEdit->setCompleter(m_findCompleter); - m_findCompleter->popup()->installEventFilter(this); m_ui.replaceEdit->setCompleter(m_replaceCompleter); m_ui.findEdit->setSide(qApp->layoutDirection() == Qt::LeftToRight ? Utils::FancyLineEdit::Right : Utils::FancyLineEdit::Left); QMenu *lineEditMenu = new QMenu(m_ui.findEdit); m_ui.findEdit->setMenu(lineEditMenu); - m_ui.findEdit->installEventFilter(this); - m_ui.replaceEdit->installEventFilter(this); - this->installEventFilter(this); - connect(m_ui.findEdit, SIGNAL(textChanged(const QString&)), this, SLOT(invokeFindIncremental())); connect(m_ui.findEdit, SIGNAL(returnPressed()), this, SLOT(invokeFindEnter())); connect(m_ui.replaceEdit, SIGNAL(returnPressed()), this, SLOT(invokeReplaceEnter())); @@ -229,6 +225,17 @@ FindToolBar::~FindToolBar() { } +void FindToolBar::installEventFilters() +{ + if (!m_eventFiltersInstalled) { + m_findCompleter->popup()->installEventFilter(this); + m_ui.findEdit->installEventFilter(this); + m_ui.replaceEdit->installEventFilter(this); + this->installEventFilter(this); + m_eventFiltersInstalled = true; + } +} + bool FindToolBar::eventFilter(QObject *obj, QEvent *event) { if (event->type() == QEvent::KeyPress) { @@ -578,6 +585,7 @@ void FindToolBar::openFind() void FindToolBar::openFindToolBar() { + installEventFilters(); if (!m_currentDocumentFind->candidateIsEnabled()) return; Core::FindToolBarPlaceHolder *holder = findToolBarPlaceHolder(); |