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.
このコミットが含まれているのは:
Albert S. 2020-06-06 23:18:33 +02:00
コミット a46ecf9bff
1個のファイルの変更2行の追加2行の削除

ファイルの表示

@ -49,6 +49,7 @@ void MainWindow::connectSignals()
{
try
{
this->ui->txtSearch->setEnabled(true);
auto results = searchWatcher.future().result();
handleSearchResults(results);
}
@ -169,8 +170,7 @@ void MainWindow::lineEditReturnPressed()
}
// TODO: validate q;
ui->lblSearchResults->setText("Searching...");
searchWatcher.cancel();
searchWatcher.waitForFinished();
this->ui->txtSearch->setEnabled(false);
QFuture<QVector<SearchResult>> searchFuture = QtConcurrent::run(
[&, q]()
{