图形界面构建
This commit is contained in:
parent
1eff876159
commit
8040bea743
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by QtCreator 6.0.0, 2021-12-15T21:09:37. -->
|
<!-- Written by QtCreator 6.0.0, 2021-12-15T22:12:07. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
@ -8,7 +8,7 @@
|
|||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
<value type="qlonglong">0</value>
|
<value type="qlonglong">2</value>
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||||
@ -83,6 +83,9 @@
|
|||||||
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
|
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
|
||||||
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
|
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
|
<valuemap type="QVariantMap" key="CppEditor.QuickFix">
|
||||||
|
<value type="bool" key="UseGlobalSettings">true</value>
|
||||||
|
</valuemap>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
@ -247,8 +250,8 @@
|
|||||||
<value type="int" key="type">0</value>
|
<value type="int" key="type">0</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">UniversalTuringMachine</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">UniversalTuringMachine</value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.IosRunConfiguration:/Users/chenhangjian/Desktop/UniversalTuringMachine/UniversalTuringMachine.pro</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.IosRunConfiguration:/Users/chenhangjian/Desktop/code/UniversialTuringMachine/UniversalTuringMachine.pro</value>
|
||||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/Users/chenhangjian/Desktop/UniversalTuringMachine/UniversalTuringMachine.pro</value>
|
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/Users/chenhangjian/Desktop/code/UniversialTuringMachine/UniversalTuringMachine.pro</value>
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||||
@ -578,12 +581,14 @@
|
|||||||
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
||||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/Users/chenhangjian/Desktop/code/UniversialTuringMachine/UniversalTuringMachine.pro</value>
|
||||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
|
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/Users/chenhangjian/Desktop/code/UniversialTuringMachine/UniversalTuringMachine.pro</value>
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||||
|
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||||
|
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/Users/chenhangjian/Desktop/build-UniversalTuringMachine-Qt_6_2_2_for_macOS-Debug/UniversalTuringMachine.app/Contents/MacOS</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
|
|||||||
117
mainwindow.cpp
117
mainwindow.cpp
@ -1,11 +1,114 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "ui_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)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
, ui(new Ui::MainWindow)
|
, ui(new Ui::MainWindow)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
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()
|
MainWindow::~MainWindow()
|
||||||
@ -13,3 +116,17 @@ MainWindow::~MainWindow()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::importFile()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
void MainWindow::startSimulate()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::nextStep()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
23
mainwindow.h
23
mainwindow.h
@ -2,6 +2,14 @@
|
|||||||
#define MAINWINDOW_H
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QGroupBox>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QListWidget>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui { class MainWindow; }
|
namespace Ui { class MainWindow; }
|
||||||
@ -14,8 +22,21 @@ class MainWindow : public QMainWindow
|
|||||||
public:
|
public:
|
||||||
MainWindow(QWidget *parent = nullptr);
|
MainWindow(QWidget *parent = nullptr);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
public slots:
|
||||||
|
void nextStep();
|
||||||
|
void importFile();
|
||||||
|
void startSimulate();
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
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
|
#endif // MAINWINDOW_H
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user