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);
|
QShortcut *enter_press = new QShortcut(QKeySequence(Qt::Key_Return), this);
|
||||||
connect(enter_press, &QShortcut::activated, this, [this]() {
|
connect(enter_press, &QShortcut::activated, this, [this]() {
|
||||||
|
disableSearch();
|
||||||
refreshSearch();
|
refreshSearch();
|
||||||
checkSearchResultEmpty();
|
checkSearchResultEmpty();
|
||||||
|
enableSearch();
|
||||||
});
|
});
|
||||||
enter_press->setContext(Qt::WidgetWithChildrenShortcut);
|
enter_press->setContext(Qt::WidgetWithChildrenShortcut);
|
||||||
|
|
||||||
connect(ui->searchButton, &QAbstractButton::clicked, this, [this]() {
|
connect(ui->searchButton, &QAbstractButton::clicked, this, [this]() {
|
||||||
|
disableSearch();
|
||||||
refreshSearch();
|
refreshSearch();
|
||||||
checkSearchResultEmpty();
|
checkSearchResultEmpty();
|
||||||
|
enableSearch();
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(ui->searchspaceCombo,
|
connect(ui->searchspaceCombo,
|
||||||
@ -310,3 +314,16 @@ void SearchWidget::updatePlaceholderText(int index)
|
|||||||
ui->filterLineEdit->setPlaceholderText("jmp rax");
|
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 refreshSearch();
|
||||||
void checkSearchResultEmpty();
|
void checkSearchResultEmpty();
|
||||||
|
void enableSearch();
|
||||||
|
void disableSearch();
|
||||||
void setScrollMode();
|
void setScrollMode();
|
||||||
void updatePlaceholderText(int index);
|
void updatePlaceholderText(int index);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user