FluentUI/example/qml/page/T_MultiWindow.qml

187 lines
4.3 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
import QtQuick.Window
import QtQuick.Controls
import FluentUI
2023-04-22 16:02:52 +08:00
import "../component"
2023-03-13 18:23:46 +08:00
FluScrollablePage{
2023-04-06 17:32:21 +08:00
property string password: ""
2023-04-22 16:02:52 +08:00
property var loginPageRegister: registerForWindowResult("/login")
2023-04-06 17:32:21 +08:00
2023-03-13 18:23:46 +08:00
title:"MultiWindow"
2023-03-13 21:18:51 +08:00
Connections{
target: loginPageRegister
function onResult(data)
{
password = data.password
}
}
2023-04-13 18:10:38 +08:00
FluArea{
Layout.fillWidth: true
height: 86
paddings: 10
Layout.topMargin: 20
Column{
spacing: 15
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
FluText{
text:"<font color='red'>Standard</font>模式窗口,每次都会创建新窗口"
}
FluButton{
text:"点击创建窗口"
onClicked: {
FluApp.navigate("/standardWindow")
}
}
}
}
FluArea{
Layout.fillWidth: true
height: 86
paddings: 10
Layout.topMargin: 10
Column{
spacing: 15
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
FluText{
text:"<font color='red'>SingleTask</font>模式窗口,如果窗口存在,这激活该窗口"
textFormat: Text.RichText
}
FluButton{
text:"点击创建窗口"
onClicked: {
FluApp.navigate("/singleTaskWindow")
}
}
}
}
FluArea{
Layout.fillWidth: true
height: 86
paddings: 10
Layout.topMargin: 10
Column{
spacing: 15
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
FluText{
text:"<font color='red'>SingleInstance</font>模式窗口,如果窗口存在,则销毁窗口,然后新建窗口"
}
FluButton{
text:"点击创建窗口"
onClicked: {
FluApp.navigate("/singleInstanceWindow")
}
}
}
}
CodeExpander{
Layout.fillWidth: true
2023-04-19 17:25:46 +08:00
Layout.topMargin: -1
2023-04-13 18:10:38 +08:00
code:'FluWindow{
//launchMode: FluWindow.Standard
//launchMode: FluWindow.SingleTask
launchMode: FluWindow.SingleInstance
}
'
}
2023-03-13 18:23:46 +08:00
FluArea{
2023-04-03 09:32:06 +08:00
Layout.fillWidth: true
2023-03-13 21:28:35 +08:00
height: 100
2023-03-13 18:23:46 +08:00
paddings: 10
Layout.topMargin: 20
Column{
2023-03-13 21:28:35 +08:00
spacing: 15
2023-03-13 18:23:46 +08:00
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
FluText{
text:"页面跳转,不携带任何参数"
}
FluButton{
text:"点击跳转"
onClicked: {
FluApp.navigate("/about")
}
}
}
}
2023-04-06 17:32:21 +08:00
CodeExpander{
Layout.fillWidth: true
2023-04-19 17:25:46 +08:00
Layout.topMargin: -1
2023-04-06 17:32:21 +08:00
code:'FluButton{
text:"点击跳转"
onClicked: {
FluApp.navigate("/about")
}
}
'
}
2023-03-13 18:23:46 +08:00
FluArea{
2023-04-03 09:32:06 +08:00
Layout.fillWidth: true
2023-03-13 21:18:51 +08:00
height: 130
2023-03-13 18:23:46 +08:00
paddings: 10
Layout.topMargin: 20
Column{
2023-03-13 21:18:51 +08:00
spacing: 15
2023-03-13 18:23:46 +08:00
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
FluText{
2023-03-13 21:18:51 +08:00
text:"页面跳转并携带参数用户名zhuzichu"
2023-03-13 18:23:46 +08:00
}
FluButton{
2023-03-13 21:18:51 +08:00
text:"点击跳转到登录"
2023-03-13 18:23:46 +08:00
onClicked: {
2023-03-13 21:18:51 +08:00
loginPageRegister.launch({username:"zhuzichu"})
2023-03-13 18:23:46 +08:00
}
}
2023-03-13 21:18:51 +08:00
FluText{
text:"登录窗口返回过来的密码->"+password
}
2023-03-13 18:23:46 +08:00
}
}
2023-04-06 17:32:21 +08:00
CodeExpander{
Layout.fillWidth: true
2023-04-19 17:25:46 +08:00
Layout.topMargin: -1
2023-04-22 16:02:52 +08:00
code:'property var loginPageRegister: registerForWindowResult("/login")
2023-04-06 17:32:21 +08:00
Connections{
target: loginPageRegister
function onResult(data)
{
password = data.password
}
}
FluButton{
text:"点击跳转"
onClicked: {
loginPageRegister.launch({username:"zhuzichu"})
}
}
'
}
2023-03-13 18:23:46 +08:00
}