This repository has been archived on 2023-08-11. You can view files and clone it, but cannot push or open issues or pull requests.
ParameterDetection/mainwindow.cpp

52 lines
1.2 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QAction>
#include <QPlainTextEdit>
#include <QLineEdit>
#include "element.h"
#include "thread.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
connect(ui->exitAction, &QAction::triggered, this, &MainWindow::close);
connect(ui->runAction, &QAction::triggered, this, &MainWindow::onExec);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::onExec()
{
ui->logPlainText->clear();
QString designation = ui->designLineEdit->text();
if (designation.isEmpty()) {
ui->logPlainText->appendPlainText("Необходимо ввести обозначение размера.");
return;
}
Thread thread;
QString result = thread.anyThread(designation);
if (!result.isEmpty()) {
ui->logPlainText->appendPlainText(result);
return;
}
Element element;
result = element.anyDimension(designation);
if (!result.isEmpty()) {
ui->logPlainText->appendPlainText(result);
return;
}
ui->logPlainText->appendPlainText("Не удалось распознать размер.");
return;
}