Skip to content

Commit

Permalink
Reduce delay when searching entries in Auto-Type select dialog
Browse files Browse the repository at this point in the history
* Fix #7596
  • Loading branch information
droidmonkey committed Mar 23, 2022
1 parent 7dc2d23 commit 2fee61a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/autotype/AutoTypeSelectDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand All @@ -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();
});

Expand Down Expand Up @@ -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)
Expand All @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions src/autotype/AutoTypeSelectDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ private slots:

private:
void buildActionMenu();
void setDelayedSearch(bool state);

QScopedPointer<Ui::AutoTypeSelectDialog> m_ui;

Expand Down

0 comments on commit 2fee61a

Please sign in to comment.