Reduce delay when searching entries in Auto-Type select dialog
* Fix #7596
This commit is contained in:
@@ -62,7 +62,7 @@ AutoTypeSelectDialog::AutoTypeSelectDialog(QWidget* parent)
|
|||||||
|
|
||||||
m_ui->search->installEventFilter(this);
|
m_ui->search->installEventFilter(this);
|
||||||
|
|
||||||
m_searchTimer.setInterval(300);
|
m_searchTimer.setInterval(0);
|
||||||
m_searchTimer.setSingleShot(true);
|
m_searchTimer.setSingleShot(true);
|
||||||
|
|
||||||
connect(m_ui->search, SIGNAL(textChanged(QString)), &m_searchTimer, SLOT(start()));
|
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);
|
m_ui->searchCheckBox->setShortcut(Qt::CTRL + Qt::Key_F);
|
||||||
connect(m_ui->searchCheckBox, &QCheckBox::toggled, this, [this](bool checked) {
|
connect(m_ui->searchCheckBox, &QCheckBox::toggled, this, [this](bool checked) {
|
||||||
Q_UNUSED(checked);
|
setDelayedSearch(checked);
|
||||||
performSearch();
|
performSearch();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -107,6 +107,7 @@ void AutoTypeSelectDialog::setMatches(const QList<AutoTypeMatch>& matches,
|
|||||||
|
|
||||||
// always perform search when updating matches to refresh view
|
// always perform search when updating matches to refresh view
|
||||||
performSearch();
|
performSearch();
|
||||||
|
setDelayedSearch(noMatches);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoTypeSelectDialog::setSearchString(const QString& search)
|
void AutoTypeSelectDialog::setSearchString(const QString& search)
|
||||||
@@ -115,6 +116,11 @@ void AutoTypeSelectDialog::setSearchString(const QString& search)
|
|||||||
m_ui->searchCheckBox->setChecked(true);
|
m_ui->searchCheckBox->setChecked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AutoTypeSelectDialog::setDelayedSearch(bool state)
|
||||||
|
{
|
||||||
|
m_searchTimer.setInterval(state ? 150 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
void AutoTypeSelectDialog::submitAutoTypeMatch(AutoTypeMatch match)
|
void AutoTypeSelectDialog::submitAutoTypeMatch(AutoTypeMatch match)
|
||||||
{
|
{
|
||||||
if (match.first) {
|
if (match.first) {
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void buildActionMenu();
|
void buildActionMenu();
|
||||||
|
void setDelayedSearch(bool state);
|
||||||
|
|
||||||
QScopedPointer<Ui::AutoTypeSelectDialog> m_ui;
|
QScopedPointer<Ui::AutoTypeSelectDialog> m_ui;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user