Reduce delay when searching entries in Auto-Type select dialog

* Fix #7596
This commit is contained in:
Jonathan White 2022-03-22 16:55:20 -04:00
parent 7dc2d236df
commit 4178e72fe0
2 changed files with 9 additions and 2 deletions

View File

@ -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<AutoTypeMatch>& 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) {

View File

@ -60,6 +60,7 @@ private slots:
private:
void buildActionMenu();
void setDelayedSearch(bool state);
QScopedPointer<Ui::AutoTypeSelectDialog> m_ui;