summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorrtk0c <[email protected]>2022-06-28 15:39:26 -0700
committerrtk0c <[email protected]>2022-06-28 15:39:26 -0700
commitd77b11b20dcd9e6c5adbc541f29bf5cdde9db1d0 (patch)
tree94a7735912875b79445e89e5ab1ba112f8338ee3 /source
parent8f0dda5eab181b0f14f2652b4e984aaaae3f258c (diff)
Initial QtQuick project
Diffstat (limited to 'source')
-rw-r--r--source/main.cpp31
-rw-r--r--source/qml/main.qml8
2 files changed, 39 insertions, 0 deletions
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 <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+#include <QLocale>
+#include <QTranslator>
+
+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")
+}