-
Notifications
You must be signed in to change notification settings - Fork 11
/
main.cpp
38 lines (30 loc) · 1.02 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
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
// data from serial port get from here
// https://github.com/eyllanesc/stackoverflow/tree/master/Arduino-QML
#include "serialport.h"
#define WIDTH "1280"
#define HEIGHT "480"
int main(int argc, char *argv[])
{
//
//Qt environment
//
qputenv("QT_QPA_EGLFS_HIDECURSOR", "1");
qputenv("QT_QPA_EGLFS_DISABLE_INPUT", "1");
qputenv("FB_MULTI_BUFFER", "2");
qputenv("QT_QPA_EGLFS_WIDTH", WIDTH);
qputenv("QT_QPA_EGLFS_HEIGHT", HEIGHT);
qputenv("QT_QPA_EGLFS_PHYSICAL_WIDTH", WIDTH);
qputenv("QT_QPA_EGLFS_PHYSICAL_HEIGHT", HEIGHT);
qputenv("QT_QPA_FONTDIR", ".");
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
qmlRegisterType<SerialPort>("SerialPortLib", 1, 0, "SerialPort");
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
return app.exec();
}