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:
والد
072996e0d3
کامیت
1e10d12f34
@ -49,14 +49,15 @@ void MainWindow::connectSignals()
|
||||
connect(&searchWatcher, &QFutureWatcher<SearchResult>::finished, this, [&]{
|
||||
try
|
||||
{
|
||||
this->ui->txtSearch->setEnabled(true);
|
||||
auto results = searchWatcher.future().result();
|
||||
handleSearchResults(results);
|
||||
|
||||
}
|
||||
catch(QSSGeneralException &e)
|
||||
{
|
||||
handleSearchError(e.message);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
connect(&pdfWorkerWatcher, &QFutureWatcher<PdfPreview>::resultReadyAt, this, [&](int index) {
|
||||
@ -165,8 +166,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]() {
|
||||
SqliteSearch searcher(db);
|
||||
this->currentQuery = QSSQuery::build(q);
|
||||
|
بارگذاری…
مرجع در شماره جدید
Block a user