FluentUI/example/qml-Qt6/page/T_MultiWindow.qml

187 lines
4.4 KiB
QML
Raw Normal View History

2023-08-24 15:50:37 +08:00
import QtQuick
import QtQuick.Layouts
import QtQuick.Window
import QtQuick.Controls
import FluentUI
2024-01-25 17:26:50 +08:00
import "../component"
2023-08-24 15:50:37 +08:00
FluScrollablePage{
property string password: ""
property var loginPageRegister: registerForWindowResult("/login")
2024-03-09 15:35:48 +08:00
title: qsTr("MultiWindow")
2023-08-24 15:50:37 +08:00
Connections{
target: loginPageRegister
function onResult(data)
{
password = data.password
}
}
FluArea{
Layout.fillWidth: true
height: 86
paddings: 10
Layout.topMargin: 20
Column{
spacing: 15
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
FluText{
2024-03-09 15:35:48 +08:00
text: qsTr("<font color='red'>Standard</font> mode windowa new window is created every time")
2023-08-24 15:50:37 +08:00
}
FluButton{
2024-03-09 15:35:48 +08:00
text: qsTr("Create Window")
2023-08-24 15:50:37 +08:00
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{
2024-03-09 15:35:48 +08:00
text: qsTr("<font color='red'>SingleTask</font> mode windowIf a window exists, this activates the window")
2023-08-24 15:50:37 +08:00
textFormat: Text.RichText
}
FluButton{
2024-03-09 15:35:48 +08:00
text: qsTr("Create Window")
2023-08-24 15:50:37 +08:00
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{
2024-03-09 15:35:48 +08:00
text: qsTr("<font color='red'>SingleInstance</font> mode windowIf the window exists, destroy the window and create a new window")
2023-08-24 15:50:37 +08:00
}
FluButton{
2024-03-09 15:35:48 +08:00
text: qsTr("Create Window")
2023-08-24 15:50:37 +08:00
onClicked: {
FluApp.navigate("/singleInstanceWindow")
}
}
}
}
CodeExpander{
Layout.fillWidth: true
Layout.topMargin: -1
code:'FluWindow{
//launchMode: FluWindowType.Standard
//launchMode: FluWindowType.SingleTask
launchMode: FluWindowType.SingleInstance
}
'
}
FluArea{
Layout.fillWidth: true
height: 100
paddings: 10
Layout.topMargin: 20
Column{
spacing: 15
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
FluText{
2024-03-09 15:35:48 +08:00
text: qsTr("Create the window without carrying any parameters")
2023-08-24 15:50:37 +08:00
}
FluButton{
2024-03-09 15:35:48 +08:00
text: qsTr("Create Window")
2023-08-24 15:50:37 +08:00
onClicked: {
FluApp.navigate("/about")
}
}
}
}
CodeExpander{
Layout.fillWidth: true
Layout.topMargin: -1
code:'FluButton{
2024-03-09 15:35:48 +08:00
text: qsTr("Create Window")
2023-08-24 15:50:37 +08:00
onClicked: {
FluApp.navigate("/about")
}
}
'
}
FluArea{
Layout.fillWidth: true
height: 130
paddings: 10
Layout.topMargin: 20
Column{
spacing: 15
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
FluText{
2024-03-09 15:35:48 +08:00
text: qsTr("Create a window with the parameter username: zhuzichu")
2023-08-24 15:50:37 +08:00
}
FluButton{
2024-03-09 15:35:48 +08:00
text: qsTr("Create Window")
2023-08-24 15:50:37 +08:00
onClicked: {
loginPageRegister.launch({username:"zhuzichu"})
}
}
FluText{
2024-03-09 15:35:48 +08:00
text:qsTr("Login Window Returned Password - >")+password
2023-08-24 15:50:37 +08:00
}
}
}
CodeExpander{
Layout.fillWidth: true
Layout.topMargin: -1
code:'property var loginPageRegister: registerForWindowResult("/login")
Connections{
target: loginPageRegister
function onResult(data)
{
password = data.password
}
}
FluButton{
2024-03-09 15:35:48 +08:00
text: qsTr("Create Window")
2023-08-24 15:50:37 +08:00
onClicked: {
loginPageRegister.launch({username:"zhuzichu"})
}
}
'
}
}