summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2026-01-29 22:23:13 +0100
committerXavier Del Campo Romero <xavi92@disroot.org>2026-02-03 16:26:52 +0100
commit2a237ac200a60daab490b0e1339a385bcc817d8c (patch)
treeb565f43014122eb92f4d4f7c5da8b8a48ddeb2bb /main.cpp
downloadyachat6-2a237ac200a60daab490b0e1339a385bcc817d8c.tar.gz
First commit
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp
new file mode 100644
index 0000000..c0aab91
--- /dev/null
+++ b/main.cpp
@@ -0,0 +1,31 @@
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+#include <QQmlContext>
+#include <QObject>
+#include <QVariant>
+#include <memory>
+#include "test.h"
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+ QQmlApplicationEngine engine("qrc:/org/yachat/lib/Main.qml");
+
+#if 0
+ qRegisterMetaType<Test>("Test");
+
+ qmlRegisterType<Test>("org.yachat.lib", 1, 0, "Test");
+#endif
+#if 1
+ qmlRegisterSingletonType<Test>("org.yachat.lib", 1, 0, "Test",
+ [](QQmlEngine *, QJSEngine *) -> QObject *
+ {
+ return std::make_unique<Test>().release();
+ }
+ );
+#else
+ Test test;
+ engine.rootContext()->setContextProperty("Test", &test);
+#endif
+ return app.exec();
+}