diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/QCplt/Qml/NodeCanvas.cpp | 1 | ||||
-rw-r--r-- | src/QCplt/Qml/NodeCanvas.hpp | 1 | ||||
-rw-r--r-- | src/QCplt/Qml/README.md | 1 | ||||
-rw-r--r-- | src/main.cpp | 35 |
4 files changed, 38 insertions, 0 deletions
diff --git a/src/QCplt/Qml/NodeCanvas.cpp b/src/QCplt/Qml/NodeCanvas.cpp new file mode 100644 index 0000000..4c53a5e --- /dev/null +++ b/src/QCplt/Qml/NodeCanvas.cpp @@ -0,0 +1 @@ +#include "NodeCanvas.hpp" diff --git a/src/QCplt/Qml/NodeCanvas.hpp b/src/QCplt/Qml/NodeCanvas.hpp new file mode 100644 index 0000000..6f70f09 --- /dev/null +++ b/src/QCplt/Qml/NodeCanvas.hpp @@ -0,0 +1 @@ +#pragma once diff --git a/src/QCplt/Qml/README.md b/src/QCplt/Qml/README.md new file mode 100644 index 0000000..379e257 --- /dev/null +++ b/src/QCplt/Qml/README.md @@ -0,0 +1 @@ +All .hpp and .cpp files in this folder are passed to Qt's buildsystem as QML source files, using CMake `file(GLOB_RECURSE)` diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..c8fb06f --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,35 @@ +#include <QGuiApplication> +#include <QQmlApplicationEngine> +#include <QLocale> +#include <QTranslator> + +int main(int argc, char* argv[]) +{ + QGuiApplication app(argc, argv); + + QTranslator translator; + 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; + QUrl url(u"qrc:/QCplt/qml/MainWindow.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(); +} |