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"])}
|
2021-01-11 16:50:34 +01:00
|
|
|
|
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"));
|
|
|
|
|
|
2021-09-03 15:37:44 +02:00
|
|
|
@endif
|
2013-11-19 17:00:38 +01:00
|
|
|
QGuiApplication app(argc, argv);
|
|
|
|
|
|
2014-01-29 15:43:04 +01:00
|
|
|
QQmlApplicationEngine engine;
|
QtQuickApplication template: Support more modern API
(Re)add a way to select the minimum supported Qt version. If it is >=
6.4, connect to QQmlApplicationEngine::objectCreationFailed instead of
objectCreated, getting rid of the status check.
Moreover, if we have Qt >= 6.4, also use qt_standard_project_setup
instead of manually enabling AUTOMOC. That is available since 6.3, but
no need to clutter the version selection list with too many entries.
If only 6.5 or higher is required, put the QML files under
AUTO_RESOURCE_PREFIX, and use loadFromModule instead of load.
Unconditionally rename main.qml to Main.qml, which is necessary for
loadFromModule to work, and making this conditional on the used Qt
version is more trouble than it is worth.
For qbs, we do not yet put the files under the auto resource prefix, so
do not use loadFromModule there.
Fixes: QTBUG-47996
Change-Id: Ib8ca375c2316b58eecf54009d36fc9f7dac7c1f4
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-01-30 11:12:10 +01:00
|
|
|
@if !%{HasLoadFromModule}
|
|
|
|
|
const QUrl url(u"qrc:/%{JS: value('ProjectName')}/Main.qml"_qs);
|
|
|
|
|
@endif
|
|
|
|
|
@if %{HasFailureSignal}
|
|
|
|
|
QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
|
|
|
|
|
&app, []() { QCoreApplication::exit(-1); },
|
|
|
|
|
Qt::QueuedConnection);
|
|
|
|
|
@else
|
2019-01-15 13:13:45 +01:00
|
|
|
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
|
|
|
|
|
&app, [url](QObject *obj, const QUrl &objUrl) {
|
|
|
|
|
if (!obj && url == objUrl)
|
|
|
|
|
QCoreApplication::exit(-1);
|
|
|
|
|
}, Qt::QueuedConnection);
|
QtQuickApplication template: Support more modern API
(Re)add a way to select the minimum supported Qt version. If it is >=
6.4, connect to QQmlApplicationEngine::objectCreationFailed instead of
objectCreated, getting rid of the status check.
Moreover, if we have Qt >= 6.4, also use qt_standard_project_setup
instead of manually enabling AUTOMOC. That is available since 6.3, but
no need to clutter the version selection list with too many entries.
If only 6.5 or higher is required, put the QML files under
AUTO_RESOURCE_PREFIX, and use loadFromModule instead of load.
Unconditionally rename main.qml to Main.qml, which is necessary for
loadFromModule to work, and making this conditional on the used Qt
version is more trouble than it is worth.
For qbs, we do not yet put the files under the auto resource prefix, so
do not use loadFromModule there.
Fixes: QTBUG-47996
Change-Id: Ib8ca375c2316b58eecf54009d36fc9f7dac7c1f4
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-01-30 11:12:10 +01:00
|
|
|
@endif
|
|
|
|
|
@if %{HasLoadFromModule}
|
|
|
|
|
engine.loadFromModule("%{JS: value('ProjectName')}", "Main");
|
|
|
|
|
@else
|
2019-01-15 13:13:45 +01:00
|
|
|
engine.load(url);
|
QtQuickApplication template: Support more modern API
(Re)add a way to select the minimum supported Qt version. If it is >=
6.4, connect to QQmlApplicationEngine::objectCreationFailed instead of
objectCreated, getting rid of the status check.
Moreover, if we have Qt >= 6.4, also use qt_standard_project_setup
instead of manually enabling AUTOMOC. That is available since 6.3, but
no need to clutter the version selection list with too many entries.
If only 6.5 or higher is required, put the QML files under
AUTO_RESOURCE_PREFIX, and use loadFromModule instead of load.
Unconditionally rename main.qml to Main.qml, which is necessary for
loadFromModule to work, and making this conditional on the used Qt
version is more trouble than it is worth.
For qbs, we do not yet put the files under the auto resource prefix, so
do not use loadFromModule there.
Fixes: QTBUG-47996
Change-Id: Ib8ca375c2316b58eecf54009d36fc9f7dac7c1f4
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-01-30 11:12:10 +01:00
|
|
|
@endif
|
2013-11-19 17:00:38 +01:00
|
|
|
|
|
|
|
|
return app.exec();
|
|
|
|
|
}
|