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