-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.qml
39 lines (34 loc) · 927 Bytes
/
main.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import QtQuick 2.6
import QtQuick.Window 2.2
Window {
id:root
visible: true
width: 380
height: 600
title: qsTr("ChatChat")
property var currentPage: null
property bool hasLogin: false
onClosing:{
if(hasLogin)
{
sendMsg(1,"broadcast");
}
}
Component.onCompleted: {
//@ set start position
setX(Screen.width / 2 - width / 2);
setY(Screen.height / 2 - height / 2);
var login=Qt.createComponent("login.qml");
currentPage=login.createObject(root);
currentPage.login.connect(onLogin);
}
function onLogin(name){
hasLogin=true;
currentPage.destroy()
//@ show home page
var home=Qt.createComponent("home.qml");
currentPage=home.createObject(root,{
"username":name
});
}
}