diff --git a/native/Main.qml b/native/Main.qml index 5f878ab..ca58216 100644 --- a/native/Main.qml +++ b/native/Main.qml @@ -42,6 +42,9 @@ Window { id: mainPageComponent MainPage { authToken: authToken + onLogout: { + stackView.push(loginPageComponent) + } } } } diff --git a/native/MainPage.qml b/native/MainPage.qml index 399697a..e42c572 100644 --- a/native/MainPage.qml +++ b/native/MainPage.qml @@ -14,6 +14,8 @@ Rectangle { property string authToken: "" + signal logout() + Rectangle { id: s1 anchors { @@ -43,12 +45,10 @@ Rectangle { rightMargin: 10 right: s1.right } - text: qsTr("Login") + text: qsTr("Logout") onClicked: { - var component = Qt.createComponent("LoginScreen.qml") - var window = component.createObject(root) - window.show() + logout(); } } } @@ -122,9 +122,7 @@ Rectangle { } text: qsTr("Login Screen") onClicked: { - var component = Qt.createComponent("LoginScreen.qml") - var window = component.createObject(root) - window.show() + logout(); } } }