diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 0888cd4..073ee66 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -49,14 +49,15 @@ void MainWindow::connectSignals() connect(&searchWatcher, &QFutureWatcher::finished, this, [&]{ try { + this->ui->txtSearch->setEnabled(true); auto results = searchWatcher.future().result(); handleSearchResults(results); + } catch(QSSGeneralException &e) { handleSearchError(e.message); } - }); connect(&pdfWorkerWatcher, &QFutureWatcher::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> searchFuture = QtConcurrent::run([&, q]() { SqliteSearch searcher(db); this->currentQuery = QSSQuery::build(q);