add autodetect in ocr scene

This commit is contained in:
leca 2025-03-30 20:50:11 +03:00
parent 6b815dbe0a
commit c17af59358
2 changed files with 13 additions and 2 deletions

View File

@ -67,7 +67,16 @@ void OCRScene::on_choose_image_button_clicked() {
std::string parsed = i.parse_text();
ui->check_text_edit->setPlainText(QString::fromStdString(parsed));
}
void OCRScene::on_check_text_edit_textChanged() {
std::string store = parser.try_autodetect_store(ui->check_text_edit->toPlainText().toStdString());
if (store == "") {
std::cerr << tr("Could not autodetect store. If you beleive that this is an error, please, report to the developer.").toStdString() << std::endl;
return;
}
unsigned int index = ui->store_combo_box->findText(QString::fromStdString(store));
ui->store_combo_box->setCurrentIndex(index);
}

View File

@ -21,6 +21,8 @@ private slots:
void on_choose_image_button_clicked();
void on_check_text_edit_textChanged();
private:
Ui::OCRScene *ui;
Parser parser;