-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
50 lines (37 loc) · 1.5 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
50
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QIcon>
#include <QStringList>
#include "src/database.h"
#include "src/notemodel.h"
#include "src/actionmodel.h"
#include "src/actionmodeldone.h"
#include "src/tablenote.h"
#include "src/applicationsettings.h"
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QCoreApplication::setAttribute(Qt::AA_DisableShaderDiskCache);
QGuiApplication app(argc, argv);
QIcon::setThemeName("anote");
ApplicationSettings *settings = ApplicationSettings::AppSettingsInstance();
settings->setFile("settings.json");
QObject::connect(settings,SIGNAL(commit()),app.inputMethod(),SLOT(commit()));
qmlRegisterType<NoteModel>("QtModel",1,0,"NoteModel");
qmlRegisterType<ActionModel>("QtModel",1,0,"ActionModel");
qmlRegisterType<ActionModelDone>("QtModel",1,0,"ActionModelDone");
TableNote tableNote;
TableAction tableAction;
Database db(tableNote,tableAction);
tableNote.getNotesDatabase(settings->isOrder());
QQmlApplicationEngine engine;
engine.rootContext()->setContextProperty("tableNote",&tableNote);
engine.rootContext()->setContextProperty("tableAction",&tableAction);
engine.rootContext()->setContextProperty("ApplicationSettings",settings);
engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
//settings->initializeAndroidKeyboard();
if (engine.rootObjects().isEmpty())
return -1;
return app.exec();
}