-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
49 lines (36 loc) · 1.19 KB
/
main.cpp
File metadata and controls
49 lines (36 loc) · 1.19 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
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <QApplication>
#include <QObject>
#include <QQmlComponent>
#include <QQmlEngine>
#include <QQuickWindow>
#include <QSurfaceFormat>
#include <QLoggingCategory>
#include <QtQml>
int main(int argc, char *argv[])
{
QApplication app(argc,argv);
app.setOrganizationName("Test");
app.setOrganizationDomain("test.com");
// disable useless warnings
QLoggingCategory::setFilterRules("qt.network.ssl.warning=false");
// hide cursor in production builds
#ifndef QT_DEBUG
// QApplication::setOverrideCursor(Qt::BlankCursor);
#endif
QQmlEngine engine;
QQmlComponent *component = new QQmlComponent(&engine);
QObject::connect(&engine, SIGNAL(quit()), QCoreApplication::instance(), SLOT(quit()));
component->loadUrl(QUrl("qrc:///main.qml"));
if (!component->isReady() ) {
qWarning("%s", qPrintable(component->errorString()));
return -1;
}
QObject *topLevel = component->create();
QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
QSurfaceFormat surfaceFormat = window->requestedFormat();
window->setFormat(surfaceFormat);
window->showFullScreen();
int rc = app.exec();
delete component;
return rc;
}