FluentUI/example/qml/window/LoginWindow.qml

64 lines
1.4 KiB
QML
Raw Normal View History

2023-05-22 16:17:51 +08:00
import QtQuick
2023-03-30 21:52:55 +08:00
import QtQuick.Layouts
2023-04-01 21:51:59 +08:00
import QtQuick.Controls
2023-03-30 21:52:55 +08:00
import FluentUI
2023-05-19 07:57:23 +08:00
import "../component"
2023-03-13 18:23:46 +08:00
2023-05-19 07:57:23 +08:00
CustomWindow {
2023-03-13 18:23:46 +08:00
id:window
2023-04-22 18:08:11 +08:00
title:"登录"
2023-03-13 18:23:46 +08:00
width: 400
height: 400
2023-05-17 18:15:15 +08:00
fixSize: true
2023-03-13 18:23:46 +08:00
onInitArgument:
(argument)=>{
2023-03-30 18:34:03 +08:00
textbox_uesrname.updateText(argument.username)
2023-03-13 18:23:46 +08:00
textbox_password.focus = true
}
ColumnLayout{
anchors{
left: parent.left
right: parent.right
verticalCenter: parent.verticalCenter
}
FluAutoSuggestBox{
id:textbox_uesrname
2023-03-30 18:34:03 +08:00
items:[{title:"Admin"},{title:"User"}]
2023-03-13 18:23:46 +08:00
placeholderText: "请输入账号"
Layout.preferredWidth: 260
Layout.alignment: Qt.AlignHCenter
}
FluTextBox{
id:textbox_password
Layout.topMargin: 20
Layout.preferredWidth: 260
placeholderText: "请输入密码"
echoMode:TextInput.Password
Layout.alignment: Qt.AlignHCenter
}
FluFilledButton{
text:"登录"
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: 20
onClicked:{
if(textbox_password.text === ""){
showError("请随便输入一个密码")
return
}
2023-03-13 21:18:51 +08:00
onResult({password:textbox_password.text})
2023-03-13 18:23:46 +08:00
window.close()
}
}
}
}