This repository has been archived on 2024-12-15. You can view files and clone it, but cannot push or open issues or pull requests.
VectorSearch/QVectorSearch/mainwindow.cpp

33 lines
797 B
C++
Raw Normal View History

2024-03-19 20:42:32 +00:00
#include "mainwindow.h"
#include "./ui_mainwindow.h"
2024-03-20 09:16:46 +00:00
#include "timer.h"
#include "word_list_generator.h"
2024-03-19 20:42:32 +00:00
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow) {
ui->setupUi(this);
2024-03-20 09:16:46 +00:00
ui->resultView->setModel(&result_model_);
generate_word_list();
2024-03-19 20:42:32 +00:00
}
MainWindow::~MainWindow() { delete ui; }
2024-03-20 09:16:46 +00:00
void MainWindow::generate_word_list() {
Timer timer;
word_list_ = WordListGenerator().generate();
timer.stop();
std::stringstream status_message;
status_message << "generated " << word_list_.size() << " words in " << timer;
ui->mainStatusBar->showMessage(QString::fromStdString(status_message.str()));
QStringList words;
for (auto word : word_list_) {
words.append(QString::fromStdString(word));
}
result_model_.setStringList(words);
}