-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
39 lines (33 loc) · 1.17 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
#include <QGuiApplication>
#include <QtQuick/QQuickView>
#include <QtQml/QQmlEngine>
#include <QtQml/QQmlContext>
//#include <QLoggingCategory>
#include <QTranslator>
#include <QScreen>
#include "bt_rfcomm.h"
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
app.setOrganizationName("baranovskiykonstantin");
QTranslator qtTranslator;
qtTranslator.load(QLocale(), "lang", "_", ":/translations");
app.installTranslator(&qtTranslator);
qmlRegisterType<BTRfcomm>("BTRfcomm", 1, 0, "BTRfcomm");
// QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
QQuickView view;
view.setTitle("Aquarium control");
view.setSource(QUrl(QStringLiteral("qrc:/qml/Main.qml")));
view.setResizeMode(QQuickView::SizeRootObjectToView);
QObject::connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit()));
#ifndef Q_OS_ANDROID
QSize screenSize = app.primaryScreen()->size();
int width = 640;
int height = 480;
int posX = (screenSize.width() - width) / 2;
int posY = (screenSize.height() - height) / 2;
view.setGeometry(QRect(posX, posY, width, height));
#endif
view.show();
return app.exec();
}