From d77b11b20dcd9e6c5adbc541f29bf5cdde9db1d0 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Tue, 28 Jun 2022 15:39:26 -0700 Subject: Initial QtQuick project --- source/main.cpp | 31 +++++++++++++++++++++++++++++++ source/qml/main.qml | 8 ++++++++ 2 files changed, 39 insertions(+) create mode 100644 source/main.cpp create mode 100644 source/qml/main.qml (limited to 'source') diff --git a/source/main.cpp b/source/main.cpp new file mode 100644 index 0000000..699e881 --- /dev/null +++ b/source/main.cpp @@ -0,0 +1,31 @@ +#include +#include + +#include +#include + +int main(int argc, char *argv[]) +{ + QGuiApplication app(argc, argv); + + QTranslator translator; + const QStringList uiLanguages = QLocale::system().uiLanguages(); + for (const QString &locale : uiLanguages) { + const QString baseName = "qcplt_" + QLocale(locale).name(); + if (translator.load(":/i18n/" + baseName)) { + app.installTranslator(&translator); + break; + } + } + + QQmlApplicationEngine engine; + const QUrl url(u"qrc:/qcplt/main.qml"_qs); + 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(); +} diff --git a/source/qml/main.qml b/source/qml/main.qml new file mode 100644 index 0000000..41424f8 --- /dev/null +++ b/source/qml/main.qml @@ -0,0 +1,8 @@ +import QtQuick + +Window { + width: 640 + height: 480 + visible: true + title: qsTr("Hello World") +} -- cgit v1.2.3-70-g09d2