From 0b76f3472d64befb7235df48d79029316ec34582 Mon Sep 17 00:00:00 2001 From: jopejoe1 Date: Thu, 11 Jul 2024 11:25:08 +0200 Subject: [PATCH] native: fix logout button --- native/Main.qml | 3 +++ native/MainPage.qml | 12 +++++------- 2 files changed, 8 insertions(+), 7 deletions(-) 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(); } } }