-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
36 lines (28 loc) · 1.09 KB
/
Copy pathmain.cpp
File metadata and controls
36 lines (28 loc) · 1.09 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
#include <QtGui/QApplication>
#include <QDeclarativeComponent> // qmlRegisterType
#include <QDeclarativeContext>
#include "qmlapplicationviewer.h"
#include "src/databasemanager.h"
#include "src/exportmanager.h"
Q_DECL_EXPORT int main(int argc, char *argv[])
{
QScopedPointer<QApplication> app(createApplication(argc, argv));
QmlApplicationViewer viewer;
// Setting database Qt class handle to QML
DatabaseManager* db = new DatabaseManager();
db->open();
viewer.rootContext()->setContextProperty("db", db);
// Setting export Qt class handle to QML
ExportManager* em = new ExportManager();
viewer.rootContext()->setContextProperty("em", em);
// Set application version
app->setApplicationVersion(APP_VERSION);
viewer.rootContext()->setContextProperty("appversion",
app->applicationVersion());
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
viewer.setMainQmlFile(QLatin1String("qml/timetracker/main.qml"));
viewer.showExpanded();
int ret = app->exec();
delete db;
return ret;
}