gui: disable searchbar when search is running
avoids waiting in the gui thread. does not try to cancel the QFuture that actually cannot be cancelled anyway. sidesteps a strange bug which rethrows already caught exception.
This commit is contained in:
parent
2b97f4a737
commit
a46ecf9bff
@ -49,6 +49,7 @@ void MainWindow::connectSignals()
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
this->ui->txtSearch->setEnabled(true);
|
||||||
auto results = searchWatcher.future().result();
|
auto results = searchWatcher.future().result();
|
||||||
handleSearchResults(results);
|
handleSearchResults(results);
|
||||||
}
|
}
|
||||||
@ -169,8 +170,7 @@ void MainWindow::lineEditReturnPressed()
|
|||||||
}
|
}
|
||||||
// TODO: validate q;
|
// TODO: validate q;
|
||||||
ui->lblSearchResults->setText("Searching...");
|
ui->lblSearchResults->setText("Searching...");
|
||||||
searchWatcher.cancel();
|
this->ui->txtSearch->setEnabled(false);
|
||||||
searchWatcher.waitForFinished();
|
|
||||||
QFuture<QVector<SearchResult>> searchFuture = QtConcurrent::run(
|
QFuture<QVector<SearchResult>> searchFuture = QtConcurrent::run(
|
||||||
[&, q]()
|
[&, q]()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user