mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 11:26:11 +00:00
Search button disabled and button text changed while search is occurring (#2928)
This commit is contained in:
parent
8cb4f867fa
commit
6f61d0d7d8
@ -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");
|
||||
}
|
||||
|
@ -77,6 +77,8 @@ private:
|
||||
|
||||
void refreshSearch();
|
||||
void checkSearchResultEmpty();
|
||||
void enableSearch();
|
||||
void disableSearch();
|
||||
void setScrollMode();
|
||||
void updatePlaceholderText(int index);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user