diff --git a/QVectorSearch/mainwindow.cpp b/QVectorSearch/mainwindow.cpp index 1007502..cb0cad2 100644 --- a/QVectorSearch/mainwindow.cpp +++ b/QVectorSearch/mainwindow.cpp @@ -33,7 +33,7 @@ void MainWindow::setupAlgorithmSelector() { void MainWindow::generateWordList() { Timer timer; - word_list_ = WordListGenerator::generate(); + word_list_ = WordListGenerator::generate(ui->wordListSizeSelector->value()); timer.stop(); std::stringstream status_message; @@ -91,10 +91,22 @@ void MainWindow::showResults( } void MainWindow::on_searchInput_textChanged(const QString &search_term) { + QGuiApplication::setOverrideCursor(Qt::WaitCursor); search(search_term); + QGuiApplication::restoreOverrideCursor(); } void MainWindow::on_searchAlgorithmSelector_currentIndexChanged(int) { + QGuiApplication::setOverrideCursor(Qt::WaitCursor); createSelectedFinder(); search(ui->searchInput->displayText()); + QGuiApplication::restoreOverrideCursor(); +} + +void MainWindow::on_wordListSizeSelector_valueChanged(int) { + QGuiApplication::setOverrideCursor(Qt::WaitCursor); + generateWordList(); + createSelectedFinder(); + search(ui->searchInput->displayText()); + QGuiApplication::restoreOverrideCursor(); } diff --git a/QVectorSearch/mainwindow.h b/QVectorSearch/mainwindow.h index 0a38215..a6f093f 100644 --- a/QVectorSearch/mainwindow.h +++ b/QVectorSearch/mainwindow.h @@ -35,6 +35,7 @@ private: private slots: void on_searchInput_textChanged(const QString &search_term); void on_searchAlgorithmSelector_currentIndexChanged(int); + void on_wordListSizeSelector_valueChanged(int new_value); private: Ui::MainWindow *ui; diff --git a/QVectorSearch/mainwindow.ui b/QVectorSearch/mainwindow.ui index 64e65ed..f3e7fa9 100644 --- a/QVectorSearch/mainwindow.ui +++ b/QVectorSearch/mainwindow.ui @@ -35,6 +35,16 @@ QLayout::SetDefaultConstraint + + + + + 0 + 0 + + + + @@ -42,6 +52,9 @@ + + + @@ -55,16 +68,20 @@ - - + + + + <html><head/><body><p>Select word-list size</p></body></html> + + - - - - - 0 - 0 - + + + + 100 + + + 1