-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.cpp
More file actions
48 lines (40 loc) · 1.21 KB
/
Copy pathmain.cpp
File metadata and controls
48 lines (40 loc) · 1.21 KB
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
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QDebug>
#include <QCoreApplication>
#include "src/observer.h"
#include "src/models/camera.h"
#include "src/utils/motionControl.h"
#include "src/utils/mathUtils.h"
class M2Sim
{
public:
explicit M2Sim(QQmlApplicationEngine &engine)
{
qmlRegisterType<Observer>("M2", 1, 0, "Observer");
qmlRegisterType<Camera>("M2", 1, 0, "Camera");
qmlRegisterType<MotionControl>("M2", 1, 0, "MotionControl");
qmlRegisterType<MathUtils>("M2", 1, 0, "MathUtils");
const QUrl mainQmlUrl("../src/qml/Main.qml");
QObject::connect(
&engine,
&QQmlApplicationEngine::objectCreated,
&engine,
[mainQmlUrl](QObject *obj, const QUrl &objUrl) {
if (!obj && objUrl == mainQmlUrl) {
qCritical() << "Failed to load QML:" << mainQmlUrl;
QCoreApplication::exit(-1);
}
},
Qt::QueuedConnection
);
engine.load(mainQmlUrl);
}
};
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
M2Sim sim(engine);
return app.exec();
}