diff --git a/src/autotype/AutoTypeSelectDialog.cpp b/src/autotype/AutoTypeSelectDialog.cpp index 0c8eefdc4a..55a0059bbf 100644 --- a/src/autotype/AutoTypeSelectDialog.cpp +++ b/src/autotype/AutoTypeSelectDialog.cpp @@ -62,7 +62,7 @@ AutoTypeSelectDialog::AutoTypeSelectDialog(QWidget* parent) m_ui->search->installEventFilter(this); - m_searchTimer.setInterval(300); + m_searchTimer.setInterval(0); m_searchTimer.setSingleShot(true); connect(m_ui->search, SIGNAL(textChanged(QString)), &m_searchTimer, SLOT(start())); @@ -71,7 +71,7 @@ AutoTypeSelectDialog::AutoTypeSelectDialog(QWidget* parent) m_ui->searchCheckBox->setShortcut(Qt::CTRL + Qt::Key_F); connect(m_ui->searchCheckBox, &QCheckBox::toggled, this, [this](bool checked) { - Q_UNUSED(checked); + setDelayedSearch(checked); performSearch(); }); @@ -107,6 +107,7 @@ void AutoTypeSelectDialog::setMatches(const QList& matches, // always perform search when updating matches to refresh view performSearch(); + setDelayedSearch(noMatches); } void AutoTypeSelectDialog::setSearchString(const QString& search) @@ -115,6 +116,11 @@ void AutoTypeSelectDialog::setSearchString(const QString& search) m_ui->searchCheckBox->setChecked(true); } +void AutoTypeSelectDialog::setDelayedSearch(bool state) +{ + m_searchTimer.setInterval(state ? 150 : 0); +} + void AutoTypeSelectDialog::submitAutoTypeMatch(AutoTypeMatch match) { if (match.first) { diff --git a/src/autotype/AutoTypeSelectDialog.h b/src/autotype/AutoTypeSelectDialog.h index 9c05804106..e0ceb03d88 100644 --- a/src/autotype/AutoTypeSelectDialog.h +++ b/src/autotype/AutoTypeSelectDialog.h @@ -60,6 +60,7 @@ private slots: private: void buildActionMenu(); + void setDelayedSearch(bool state); QScopedPointer m_ui;