-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
43 lines (34 loc) · 1021 Bytes
/
main.cpp
File metadata and controls
43 lines (34 loc) · 1021 Bytes
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
#ifdef QT_WIDGETS_LIB
#include <QApplication>
#else
#include <QGuiApplication>
#endif
#include <QFontDatabase>
#include <QDebug>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QQuickStyle>
#include "include/documenthandler.h"
int main(int argc, char *argv[])
{
QGuiApplication::setApplicationName("Word Processor");
QGuiApplication::setOrganizationName("QtProject");
#ifdef QT_WIDGETS_LIB
QApplication app(argc, argv);
#else
QGuiApplication app(argc, argv);
#endif
if (QFontDatabase::addApplicationFont(":/fonts/fontello.ttf") == -1)
qWarning() << "Failed to load fontello.ttf";
qmlRegisterType<DocumentHandler>("my.wordprocessor", 1, 0, "DocumentHandler");
QStringList selectors;
#ifdef QT_EXTRA_FILE
selectors += QT_EXTRA_FILE;
#endif
QQmlApplicationEngine engine;
engine.setExtraFileSelectors(selectors);
engine.load(QUrl("qrc:/qml/wordprocessor.qml"));
if (engine.rootObjects().isEmpty())
return -1;
return app.exec();
}