This repository has been archived by the owner on May 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
49 lines (43 loc) · 1.68 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QQuickStyle>
#include <QFont>
#include "middle/fileprocess.h"
#include "middle/debug.h"
#include "middle/codetablemodel.h"
#include "middle/registertablemodel.h"
#include "middle/memorytablemodel.h"
#include "middle/tools.h"
#include "main.h"
System sys;
int main(int argc, char *argv[]) {
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
FileProcess fileProcess;
Debug debug;
CodeTableModel codeTableModel;
RegisterTableModel registerTableModel;
MemoryTableModel memoryTableModel;
Tools tools;
registerTableModel.initTable();
engine.rootContext()->setContextProperty("fileProcess", &fileProcess);
engine.rootContext()->setContextProperty("debug", &debug);
engine.rootContext()->setContextProperty("codeTableModel", &codeTableModel);
engine.rootContext()->setContextProperty("registerTableModel", ®isterTableModel);
engine.rootContext()->setContextProperty("memoryTableModel", &memoryTableModel);
engine.rootContext()->setContextProperty("tools", &tools);
qmlRegisterType<CodeTableModel>("CodeTableModel", 1, 0, "CodeTableModel");
QQuickStyle::setStyle("Material");
QFont font("Microsoft YaHei", 24);
app.setFont(font);
app.setOrganizationName("MIPS-simulator");
app.setOrganizationDomain("MIPS-simulator");
app.setApplicationName("MIPS-simulator");
const QUrl url(u"qrc:/MIPS-simulator/front/Main.qml"_qs);
QObject::connect(
&engine, &QQmlApplicationEngine::objectCreationFailed, &app, []() { QCoreApplication::exit(-1); },
Qt::QueuedConnection);
engine.load(url);
return app.exec();
}