diff options
Diffstat (limited to 'examples/qml/qml-i18n/main.cpp')
-rw-r--r-- | examples/qml/qml-i18n/main.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/examples/qml/qml-i18n/main.cpp b/examples/qml/qml-i18n/main.cpp index d03cb05aed..fe20802d3d 100644 --- a/examples/qml/qml-i18n/main.cpp +++ b/examples/qml/qml-i18n/main.cpp @@ -1,5 +1,6 @@ -// Copyright (C) 2020 The Qt Company Ltd. +// Copyright (C) 2024 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + #include <QGuiApplication> #include <QQmlApplicationEngine> @@ -7,14 +8,11 @@ int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQmlApplicationEngine engine; - const QUrl url(QStringLiteral("qrc:/qml-i18n.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); + QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed, + &app, []() { QCoreApplication::exit(-1); }, + Qt::QueuedConnection); + engine.loadFromModule("Translated", "Main"); return app.exec(); } |