2015-05-12 14:21:38 +02:00
|
|
|
%{Cpp:LicenseTemplate}\
|
2015-08-22 19:16:53 +09:00
|
|
|
%{JS: QtSupport.qtIncludes([], ["QtGui/QGuiApplication", "QtQml/QQmlApplicationEngine"])}
|
2013-11-19 17:00:38 +01:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
|
{
|
2016-08-10 14:13:43 +02:00
|
|
|
@if %{UseVirtualKeyboard}
|
|
|
|
|
qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
|
|
|
|
|
|
|
|
|
|
@endif
|
2017-12-01 15:26:27 +01:00
|
|
|
@if %{SetQPAPhysicalSize}
|
|
|
|
|
if (qEnvironmentVariableIsEmpty("QTGLESSTREAM_DISPLAY")) {
|
|
|
|
|
qputenv("QT_QPA_EGLFS_PHYSICAL_WIDTH", QByteArray("213"));
|
|
|
|
|
qputenv("QT_QPA_EGLFS_PHYSICAL_HEIGHT", QByteArray("120"));
|
|
|
|
|
|
|
|
|
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
|
|
|
}
|
|
|
|
|
@else
|
2017-08-01 15:37:05 +02:00
|
|
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
2017-12-01 15:26:27 +01:00
|
|
|
@endif
|
2017-08-01 15:37:05 +02:00
|
|
|
|
2013-11-19 17:00:38 +01:00
|
|
|
QGuiApplication app(argc, argv);
|
|
|
|
|
|
2014-01-29 15:43:04 +01:00
|
|
|
QQmlApplicationEngine engine;
|
2017-09-29 15:56:36 +02:00
|
|
|
|
|
|
|
|
const QUrl mainQml(QStringLiteral("qrc:/main.qml"));
|
|
|
|
|
|
|
|
|
|
// Catch the objectCreated signal, so that we can determine if the root component was loaded
|
|
|
|
|
// successfully. If not, then the object created from it will be null. The root component may
|
|
|
|
|
// get loaded asynchronously.
|
|
|
|
|
const QMetaObject::Connection connection = QObject::connect(
|
|
|
|
|
&engine, &QQmlApplicationEngine::objectCreated,
|
|
|
|
|
&app, [&](QObject *object, const QUrl &url) {
|
|
|
|
|
if (url != mainQml)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!object)
|
|
|
|
|
app.exit(-1);
|
|
|
|
|
else
|
|
|
|
|
QObject::disconnect(connection);
|
|
|
|
|
}, Qt::QueuedConnection);
|
|
|
|
|
|
|
|
|
|
engine.load(mainQml);
|
2013-11-19 17:00:38 +01:00
|
|
|
|
|
|
|
|
return app.exec();
|
|
|
|
|
}
|