forked from qt-creator/qt-creator
Guard against random deprecations by using a robust solution that works across all Qt versions. Fixes: QTCREATORBUG-30325 Change-Id: I00428d2454fcd6abffd3a25631946ea5d27cc4ae Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
35 lines
1.0 KiB
C++
35 lines
1.0 KiB
C++
%{Cpp:LicenseTemplate}\
|
|
%{JS: QtSupport.qtIncludes([], ["QtGui/QGuiApplication", "QtQml/QQmlApplicationEngine"])}
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
@if %{UseVirtualKeyboard}
|
|
qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
|
|
|
|
@endif
|
|
QGuiApplication app(argc, argv);
|
|
|
|
QQmlApplicationEngine engine;
|
|
@if !%{HasLoadFromModule}
|
|
const QUrl url(QStringLiteral("qrc:/%{JS: value('ProjectName')}/Main.qml"));
|
|
@endif
|
|
@if %{HasFailureSignal}
|
|
QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
|
|
&app, []() { QCoreApplication::exit(-1); },
|
|
Qt::QueuedConnection);
|
|
@else
|
|
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
|
&app, [url](QObject *obj, const QUrl &objUrl) {
|
|
if (!obj && url == objUrl)
|
|
QCoreApplication::exit(-1);
|
|
}, Qt::QueuedConnection);
|
|
@endif
|
|
@if %{HasLoadFromModule}
|
|
engine.loadFromModule("%{JS: value('ProjectName')}", "Main");
|
|
@else
|
|
engine.load(url);
|
|
@endif
|
|
|
|
return app.exec();
|
|
}
|