diff --git a/src/widgets/SearchWidget.cpp b/src/widgets/SearchWidget.cpp index ae3c419b..fc5e5d43 100644 --- a/src/widgets/SearchWidget.cpp +++ b/src/widgets/SearchWidget.cpp @@ -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"); +} diff --git a/src/widgets/SearchWidget.h b/src/widgets/SearchWidget.h index 8da8b25b..08a9fc14 100644 --- a/src/widgets/SearchWidget.h +++ b/src/widgets/SearchWidget.h @@ -77,6 +77,8 @@ private: void refreshSearch(); void checkSearchResultEmpty(); + void enableSearch(); + void disableSearch(); void setScrollMode(); void updatePlaceholderText(int index); };