-
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathmain.cpp
More file actions
26 lines (22 loc) · 838 Bytes
/
main.cpp
File metadata and controls
26 lines (22 loc) · 838 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
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QFontDatabase>
#include <QFont>
#include <QtQml>
#include "trans.h"
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
// QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
// set the custom font from resources
int id = QFontDatabase::addApplicationFont(":/fonts/TitilliumWeb-Regular.ttf");
app.setFont(QFont(QFontDatabase::applicationFontFamilies(id).at(0)));
// you can just comment this, really
QQmlApplicationEngine engine;
// object of our class with "magic" property for translation
Trans trans(&engine);
// make this object available from QML side
engine.rootContext()->setContextProperty("trans", &trans);
engine.load(QUrl(QLatin1String("qrc:/main.qml")));
return app.exec();
}