diff options
m--------- | librtclient | 0 | ||||
-rw-r--r-- | main.cxx | 8 | ||||
-rw-r--r-- | worker.cxx | 2 |
3 files changed, 7 insertions, 3 deletions
diff --git a/librtclient b/librtclient -Subproject b4ed4766047759c875aa42cc35b52ccecbfcc6e +Subproject f4f2546bad4ad3bffb2ffe8f561445c81dd2fda @@ -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(); @@ -4,7 +4,7 @@ Worker::Worker(QObject* parent) : QObject{parent} { - rtclient_init(); + rtclient_init("https://darapsa.co.id/rt"); } void Worker::logIn(QString const& name, QString const& password) |