Search button disabled and button text changed while search is occurring (#2928)

This commit is contained in:
Jakob Zielinski 2022-05-07 08:01:10 -04:00 committed by Anton Kochkov
parent 34b1f01a86
commit e022e44474
2 changed files with 19 additions and 0 deletions

View File

@ -195,14 +195,18 @@ SearchWidget::SearchWidget(MainWindow *main) : CutterDockWidget(main), ui(new Ui
QShortcut *enter_press = new QShortcut(QKeySequence(Qt::Key_Return), this);
connect(enter_press, &QShortcut::activated, this, [this]() {
disableSearch();
refreshSearch();
checkSearchResultEmpty();
enableSearch();
});
enter_press->setContext(Qt::WidgetWithChildrenShortcut);
connect(ui->searchButton, &QAbstractButton::clicked, this, [this]() {
disableSearch();
refreshSearch();
checkSearchResultEmpty();
enableSearch();
});
connect(ui->searchspaceCombo,
@ -310,3 +314,16 @@ void SearchWidget::updatePlaceholderText(int index)
ui->filterLineEdit->setPlaceholderText("jmp rax");
}
}
void SearchWidget::disableSearch()
{
ui->searchButton->setEnabled(false);
ui->searchButton->setText("Searching...");
qApp->processEvents();
}
void SearchWidget::enableSearch()
{
ui->searchButton->setEnabled(true);
ui->searchButton->setText("Search");
}

View File

@ -77,6 +77,8 @@ private:
void refreshSearch();
void checkSearchResultEmpty();
void enableSearch();
void disableSearch();
void setScrollMode();
void updatePlaceholderText(int index);
};