From 26a894a1ebdc943cb04cb7455345566b65768d9c Mon Sep 17 00:00:00 2001 From: rtk0c Date: Thu, 30 Jun 2022 21:00:37 -0700 Subject: Rearrange project, add .clang-format and .clang-tidy --- src/QCplt/Qml/NodeCanvas.cpp | 1 + src/QCplt/Qml/NodeCanvas.hpp | 1 + src/QCplt/Qml/README.md | 1 + src/main.cpp | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 src/QCplt/Qml/NodeCanvas.cpp create mode 100644 src/QCplt/Qml/NodeCanvas.hpp create mode 100644 src/QCplt/Qml/README.md create mode 100644 src/main.cpp (limited to 'src') 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 +#include +#include +#include + +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(); +} -- cgit v1.2.3-70-g09d2