diff options
-rw-r--r-- | Login.qml | 3 | ||||
-rw-r--r-- | controller.cxx | 4 | ||||
-rw-r--r-- | main.qml | 8 | ||||
-rw-r--r-- | pages/ConfirmPassword.qml | 2 |
4 files changed, 12 insertions, 5 deletions
@@ -1,6 +1,9 @@ import QtQuick 2.12 LoginForm { + signal logIn(string name, string password) + + objectName: "login" width: appWindow.width height: appWindow.height diff --git a/controller.cxx b/controller.cxx index 9d77cf4..3b4b4de 100644 --- a/controller.cxx +++ b/controller.cxx @@ -12,7 +12,9 @@ Controller::Controller(QObject* parent) : QObject{parent} auto engine = dynamic_cast<QQmlApplicationEngine*>(parent); auto rootObjects = engine->rootObjects(); auto appWindow = rootObjects[0]; - connect(appWindow, SIGNAL(logIn(QString, QString)), + + auto loginView = appWindow->findChild<QObject*>("login"); + connect(loginView, SIGNAL(logIn(QString, QString)), worker, SLOT(logIn(QString, QString))); auto user = engine->singletonInstance<User*>(User::typeId); @@ -3,14 +3,14 @@ import QtQuick.Controls 2.12 import QtQuick.Controls.Material 2.12 ApplicationWindow { + property alias login: login + id: appWindow width: 360 height: 640 visible: true Material.accent: Material.DeepPurple - signal logIn(string name, string password) - Drawer { id: drawer width: 0.8 * appWindow.width @@ -21,6 +21,8 @@ ApplicationWindow { id: stackView anchors.fill : parent - initialItem: Login {} + initialItem: Login { + id: login + } } } diff --git a/pages/ConfirmPassword.qml b/pages/ConfirmPassword.qml index 51390f9..3e1df7a 100644 --- a/pages/ConfirmPassword.qml +++ b/pages/ConfirmPassword.qml @@ -13,7 +13,7 @@ PasswordForm { createPassButton { text: qsTr("Confirm password") onClicked: { - appWindow.logIn(User.name, User.password) + login.logIn(User.name, User.password) stackView.push("qrc:/pages/CreateProfile.qml") } } |