summaryrefslogtreecommitdiff
path: root/main.cxx
diff options
context:
space:
mode:
authorAnatasof Wirapraja <anatasof.wirapraja@gmail.com>2019-09-01 17:17:08 +0700
committerAnatasof Wirapraja <anatasof.wirapraja@gmail.com>2019-09-01 17:17:08 +0700
commit94a6441070c2f3dc914c213829985f04d86c66de (patch)
treee603fcb11a4d3106d1f5c3bdb8883ae0ab7ad5ea /main.cxx
parent928e7f942b7dd54d1c5de0b4d37f825e31e1f251 (diff)
parenta52ce8bdc2ebabc1f883f4573025e7526d96b80f (diff)
Merge branch 'master' of ssh://darapsa.co.id/usr/local/git/kelakon into development
* 'master' of ssh://darapsa.co.id/usr/local/git/kelakon: The server URL setting is done at the rtclient's initialisation Made sure the user and controller singletons are instantiated early
Diffstat (limited to 'main.cxx')
-rw-r--r--main.cxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/main.cxx b/main.cxx
index a29e917..23ba4ac 100644
--- a/main.cxx
+++ b/main.cxx
@@ -9,16 +9,20 @@ int main(int argc, char* argv[])
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
- qmlRegisterSingletonType<User>("id.co.darapsa.kelakon.user", 0, 1, "User", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject* {
+ auto typeId = qmlRegisterSingletonType<User>("id.co.darapsa.kelakon.user", 0, 1, "User", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject* {
Q_UNUSED(engine)
Q_UNUSED(scriptEngine)
return new User{};
});
- qmlRegisterSingletonType<User>("id.co.darapsa.kelakon.rtclient", 0, 1, "RTClient", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject* {
+ auto user = engine.singletonInstance<User*>(typeId);
+ Q_UNUSED(user)
+ typeId = qmlRegisterSingletonType<User>("id.co.darapsa.kelakon.rtclient", 0, 1, "RTClient", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject* {
Q_UNUSED(engine)
Q_UNUSED(scriptEngine)
return new Controller{};
});
+ auto controller = engine.singletonInstance<Controller*>(typeId);
+ Q_UNUSED(controller)
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
return app.exec();