aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/quickshapes/weatherforecast/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/quick/quickshapes/weatherforecast/main.cpp')
-rw-r--r--examples/quick/quickshapes/weatherforecast/main.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/examples/quick/quickshapes/weatherforecast/main.cpp b/examples/quick/quickshapes/weatherforecast/main.cpp
new file mode 100644
index 0000000000..52264b8a6e
--- /dev/null
+++ b/examples/quick/quickshapes/weatherforecast/main.cpp
@@ -0,0 +1,25 @@
+// Copyright (C) 2024 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+#endif
+ QGuiApplication app(argc, argv);
+ app.setOrganizationName("QtProject");
+
+ QQmlApplicationEngine engine;
+ const QUrl url(QStringLiteral("qrc:/qt/qml/weatherforecast/main.qml"));
+ QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
+ &app, [url](QObject *obj, const QUrl &objUrl) {
+ if (!obj && url == objUrl)
+ QCoreApplication::exit(-1);
+ }, Qt::QueuedConnection);
+ engine.load(url);
+
+ return app.exec();
+}