diff options
author | Erik Prabowo Kamal <erik@darapsa.co.id> | 2019-08-28 15:46:12 +0800 |
---|---|---|
committer | Erik Prabowo Kamal <erik@darapsa.co.id> | 2019-08-28 15:46:12 +0800 |
commit | 222e2cdd3a64fcdee3b0178e60f097429fe7a242 (patch) | |
tree | bf563c44af8dd296bf043bfecb896b3da20e325b | |
parent | 5defc7ca72cf0e6f9aa63c1151e35881cd495007 (diff) |
Registered the user singleton type
-rw-r--r-- | main.cxx | 8 | ||||
-rw-r--r-- | pages/Email.qml | 3 |
2 files changed, 11 insertions, 0 deletions
@@ -1,6 +1,7 @@ #include <QGuiApplication> #include <QQmlApplicationEngine> #include <QThread> +#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<User>("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(); diff --git a/pages/Email.qml b/pages/Email.qml index 1c0d800..531ceff 100644 --- a/pages/Email.qml +++ b/pages/Email.qml @@ -1,11 +1,14 @@ import QtQuick 2.12 +import id.co.darapsa.kelakon.user 0.1 EmailForm { width: stackView.width height: stackView.height + property string emailAddress: User.emailAddress loginButton { onClicked: { + emailAddress = emailTextField.text stackView.push("qrc:/pages/Password.qml") } } |