From 222e2cdd3a64fcdee3b0178e60f097429fe7a242 Mon Sep 17 00:00:00 2001 From: Erik Prabowo Kamal Date: Wed, 28 Aug 2019 15:46:12 +0800 Subject: Registered the user singleton type --- main.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'main.cxx') diff --git a/main.cxx b/main.cxx index 41b25af..cacf2cd 100644 --- a/main.cxx +++ b/main.cxx @@ -1,6 +1,7 @@ #include #include #include +#include "user.hxx" #include "networkworker.hxx" int main(int argc, char* argv[]) @@ -13,6 +14,13 @@ int main(int argc, char* argv[]) QThread thread; worker.moveToThread(&thread); + qmlRegisterSingletonType("id.co.darapsa.kelakon.user", 0, 1, "User", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject* { + Q_UNUSED(engine) + Q_UNUSED(scriptEngine) + + User* user = new User{}; + return user; + }); engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); thread.start(); -- cgit v1.2.3