From 8040bea743236e46ec23f31481f95b1c4757d8b1 Mon Sep 17 00:00:00 2001 From: Jafarichen <3149829972@qq.com> Date: Wed, 15 Dec 2021 22:12:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E5=BD=A2=E7=95=8C=E9=9D=A2=E6=9E=84?= =?UTF-8?q?=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UniversalTuringMachine.pro.user | 17 +++-- mainwindow.cpp | 117 ++++++++++++++++++++++++++++++++ mainwindow.h | 23 ++++++- 3 files changed, 150 insertions(+), 7 deletions(-) diff --git a/UniversalTuringMachine.pro.user b/UniversalTuringMachine.pro.user index 275a74e..2c9554e 100644 --- a/UniversalTuringMachine.pro.user +++ b/UniversalTuringMachine.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -8,7 +8,7 @@ ProjectExplorer.Project.ActiveTarget - 0 + 2 ProjectExplorer.Project.EditorSettings @@ -83,6 +83,9 @@ true + + true + @@ -247,8 +250,8 @@ 0 UniversalTuringMachine - Qt4ProjectManager.IosRunConfiguration:/Users/chenhangjian/Desktop/UniversalTuringMachine/UniversalTuringMachine.pro - /Users/chenhangjian/Desktop/UniversalTuringMachine/UniversalTuringMachine.pro + Qt4ProjectManager.IosRunConfiguration:/Users/chenhangjian/Desktop/code/UniversialTuringMachine/UniversalTuringMachine.pro + /Users/chenhangjian/Desktop/code/UniversialTuringMachine/UniversalTuringMachine.pro false true false @@ -578,12 +581,14 @@ 2 - ProjectExplorer.CustomExecutableRunConfiguration - + Qt4ProjectManager.Qt4RunConfiguration:/Users/chenhangjian/Desktop/code/UniversialTuringMachine/UniversalTuringMachine.pro + /Users/chenhangjian/Desktop/code/UniversialTuringMachine/UniversalTuringMachine.pro false true + true false true + /Users/chenhangjian/Desktop/build-UniversalTuringMachine-Qt_6_2_2_for_macOS-Debug/UniversalTuringMachine.app/Contents/MacOS 1 diff --git a/mainwindow.cpp b/mainwindow.cpp index 41a26bd..a5c0844 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,11 +1,114 @@ #include "mainwindow.h" #include "ui_mainwindow.h" +#define START_X 40 +#define START_Y 40 +#define DELTA_Y 50 +#define LABEL_X 50 +#define LABEL_Y 40 +#define LINE_X 200 +#define LINE_Y 30 MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); + this->setFixedSize(1000, 700); + this->setWindowTitle("Universal Turing Machine"); + + label_k = new QLabel(this); + label_k->setGeometry(START_X, START_Y+DELTA_Y*0, LABEL_X, LABEL_Y); + label_k->setText("K"); + + label_sigma = new QLabel(this); + label_sigma->setGeometry(START_X, START_Y+DELTA_Y*1, LABEL_X, LABEL_Y); + label_sigma->setText("sigma"); + + label_gama = new QLabel(this); + label_gama->setGeometry(START_X, START_Y+DELTA_Y*2, LABEL_X, LABEL_Y); + label_gama->setText("gama"); + + label_q0 = new QLabel(this); + label_q0->setGeometry(START_X, START_Y+DELTA_Y*3, LABEL_X, LABEL_Y); + label_q0->setText("q0"); + + label_B = new QLabel(this); + label_B->setGeometry(START_X, START_Y+DELTA_Y*4, LABEL_X, LABEL_Y); + label_B->setText("B"); + + label_F = new QLabel(this); + label_F->setGeometry(START_X, START_Y+DELTA_Y*5, LABEL_X, LABEL_Y); + label_F->setText("F"); + + line_k = new QLineEdit(this); + line_k->setFixedSize(LINE_X,LINE_Y); + line_sigma = new QLineEdit(this); + line_sigma->setFixedSize(LINE_X,LINE_Y); + line_gama = new QLineEdit(this); + line_gama->setFixedSize(LINE_X,LINE_Y); + line_q0 = new QLineEdit(this); + line_q0->setFixedSize(LINE_X,LINE_Y); + line_B = new QLineEdit(this); + line_B->setFixedSize(LINE_X,LINE_Y); + line_F = new QLineEdit(this); + line_F->setFixedSize(LINE_X,LINE_Y); + + layout_label = new QVBoxLayout(this); + layout_label->addWidget(label_k); + layout_label->addWidget(label_sigma); + layout_label->addWidget(label_gama); + layout_label->addWidget(label_q0); + layout_label->addWidget(label_B); + layout_label->addWidget(label_F); + + layout_line = new QVBoxLayout(this); + layout_line->addWidget(line_k); + layout_line->addWidget(line_sigma); + layout_line->addWidget(line_gama); + layout_line->addWidget(line_q0); + layout_line->addWidget(line_B); + layout_line->addWidget(line_F); + + layout_1=new QHBoxLayout(this); + layout_1->addLayout(layout_label); + layout_1->addLayout(layout_line); + + group_1=new QGroupBox(this); + group_1->setGeometry(40, 40, 300, 400); + group_1->setLayout(layout_1); + + //配置文件引入窗 + list_file = new QListWidget(this); + list_file->setGeometry(380, 40, 280, 220); + + btn_import = new QPushButton(this); + btn_import->setGeometry(380, 280, 280, 40); + btn_import->setText("导入文件"); + + //状态转移函数框 + list_func = new QListWidget(this); + list_func->setGeometry(700, 40, 280, 300); + + //输入纸带 + label_str = new QLabel(this); + label_str->setGeometry(380, 365, 60, 30); + label_str->setText("输入纸带:"); + + line_str = new QLineEdit(this); + line_str->setGeometry(440,360,420,40); + + btn_confirm = new QPushButton(this); + btn_confirm->setGeometry(870, 360, 50, 40); + btn_confirm->setText("确认"); + + btn_step = new QPushButton(this); + btn_step->setGeometry(930, 360, 50, 40); + btn_step->setText("下一步"); + + QObject::connect(btn_import, SIGNAL(clicked()), this, SLOT(importFile())); + QObject::connect(btn_confirm, SIGNAL(clicked()), this, SLOT(startSimulate())); + QObject::connect(btn_step, SIGNAL(clicked()), this, SLOT(nextStep())); + } MainWindow::~MainWindow() @@ -13,3 +116,17 @@ MainWindow::~MainWindow() delete ui; } +void MainWindow::importFile() +{ + +} +void MainWindow::startSimulate() +{ + +} + +void MainWindow::nextStep() +{ + + +} diff --git a/mainwindow.h b/mainwindow.h index 4643e32..f0a2d00 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -2,6 +2,14 @@ #define MAINWINDOW_H #include +#include +#include +#include +#include +#include +#include +#include +#include QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } @@ -14,8 +22,21 @@ class MainWindow : public QMainWindow public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); - +public slots: + void nextStep(); + void importFile(); + void startSimulate(); private: Ui::MainWindow *ui; + QLabel *label_k,*label_sigma,*label_gama,*label_q0,*label_B,*label_F; + QLineEdit *line_k,*line_sigma,*line_gama,*line_q0,*line_B,*line_F; + QLineEdit *line_str; + QVBoxLayout *layout_label,*layout_line; + QLabel *label_str; + QHBoxLayout *layout_1; + QGroupBox *group_1; + QListWidget *list_file,*list_func; + QPushButton *btn_import,*btn_confirm,*btn_step; + }; #endif // MAINWINDOW_H