diff options
author | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-09-05 21:21:52 +0800 |
---|---|---|
committer | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-09-05 21:21:52 +0800 |
commit | 89bff3fa5d58aeb0d507d633aa058d781f06a8c0 (patch) | |
tree | a3b23ad8052601e75b1c7e317d6b469c745b36a8 /main.cxx | |
parent | 3df0c7543d9b1a63af736acc490a27f18ef6de7a (diff) |
Connected a more straightforward signal to login
Diffstat (limited to 'main.cxx')
-rw-r--r-- | main.cxx | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -7,21 +7,20 @@ int main(int argc, char* argv[]) { QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication app(argc, argv); - QQmlApplicationEngine engine; + qmlRegisterSingletonType<User>("id.co.darapsa.kelakon.user", 0, 1, "User", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject* { Q_UNUSED(engine) Q_UNUSED(scriptEngine) return new User{}; }); - auto 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"))); + auto rootObjects = engine.rootObjects(); + if (rootObjects.isEmpty()) return -1; + + auto appWindow = rootObjects[0]; + Controller controller{appWindow}; return app.exec(); } |