-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
34 lines (27 loc) · 1014 Bytes
/
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
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include "accelerometer.h"
#include "gyroscope.h"
#include "movementdatabase.h"
#include "patterndatabase.h"
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
qmlRegisterType<Accelerometer>("com.example", 1, 0, "Accelerometer");
qmlRegisterType<Gyroscope>("com.example", 1, 0, "Gyroscope");
qmlRegisterType<MovementDatabase>("com.example", 1, 0, "MovementDatabase");
qmlRegisterType<PatternDatabase>("com.example", 1, 0, "PatternDatabase");
QQmlApplicationEngine engine;
MovementDatabase movementDatabase;
engine.rootContext()->setContextProperty("movementDatabase", &movementDatabase);
const QUrl url(u"qrc:/QtQuickProject/Main.qml"_qs);
QObject::connect(
&engine,
&QQmlApplicationEngine::objectCreationFailed,
&app,
[]() { QCoreApplication::exit(-1); },
Qt::QueuedConnection);
engine.load(url);
return app.exec();
}