FluentUI/example/qml/page/T_MultiWindow.qml

186 lines
4.5 KiB
QML
Raw Normal View History

2023-08-24 15:50:37 +08:00
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import FluentUI 1.0
2023-08-26 17:20:30 +08:00
import "../component"
2023-03-13 18:23:46 +08:00
FluScrollablePage{
2023-04-06 17:32:21 +08:00
property string password: ""
2024-03-09 15:35:48 +08:00
title: qsTr("MultiWindow")
2023-03-13 21:18:51 +08:00
2024-03-27 00:36:56 +08:00
FluWindowResultLauncher{
id:loginResultLauncher
path: "/login"
onResult:
(data)=>{
password = data.password
}
2023-03-13 21:18:51 +08:00
}
2024-03-29 16:56:09 +08:00
FluFrame{
2023-04-13 18:10:38 +08:00
Layout.fillWidth: true
2024-03-29 16:23:16 +08:00
Layout.preferredHeight: 86
padding: 10
2023-04-13 18:10:38 +08:00
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-04-13 18:10:38 +08:00
}
FluButton{
2024-03-09 15:35:48 +08:00
text: qsTr("Create Window")
2023-04-13 18:10:38 +08:00
onClicked: {
2024-03-27 00:36:56 +08:00
FluRouter.navigate("/standardWindow")
2023-04-13 18:10:38 +08:00
}
}
}
}
2024-03-29 16:56:09 +08:00
FluFrame{
2023-04-13 18:10:38 +08:00
Layout.fillWidth: true
2024-03-29 16:23:16 +08:00
Layout.preferredHeight: 86
padding: 10
2023-04-13 18:10:38 +08:00
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-04-13 18:10:38 +08:00
textFormat: Text.RichText
}
FluButton{
2024-03-09 15:35:48 +08:00
text: qsTr("Create Window")
2023-04-13 18:10:38 +08:00
onClicked: {
2024-03-27 00:36:56 +08:00
FluRouter.navigate("/singleTaskWindow")
2023-04-13 18:10:38 +08:00
}
}
}
}
2024-03-29 16:56:09 +08:00
FluFrame{
2023-04-13 18:10:38 +08:00
Layout.fillWidth: true
2024-03-29 16:23:16 +08:00
Layout.preferredHeight: 86
padding: 10
2023-04-13 18:10:38 +08:00
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-04-13 18:10:38 +08:00
}
FluButton{
2024-03-09 15:35:48 +08:00
text: qsTr("Create Window")
2023-04-13 18:10:38 +08:00
onClicked: {
2024-03-27 00:36:56 +08:00
FluRouter.navigate("/singleInstanceWindow")
2023-04-13 18:10:38 +08:00
}
}
}
}
CodeExpander{
Layout.fillWidth: true
2024-03-29 16:23:16 +08:00
Layout.topMargin: -6
2023-04-13 18:10:38 +08:00
code:'FluWindow{
2023-07-18 18:24:06 +08:00
//launchMode: FluWindowType.Standard
//launchMode: FluWindowType.SingleTask
launchMode: FluWindowType.SingleInstance
2023-04-13 18:10:38 +08:00
}
'
}
2024-03-29 16:56:09 +08:00
FluFrame{
2023-04-03 09:32:06 +08:00
Layout.fillWidth: true
2024-03-29 16:23:16 +08:00
Layout.preferredHeight: 100
padding: 10
2023-03-13 18:23:46 +08:00
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{
2024-03-09 15:35:48 +08:00
text: qsTr("Create the window without carrying any parameters")
2023-03-13 18:23:46 +08:00
}
FluButton{
2024-03-09 15:35:48 +08:00
text: qsTr("Create Window")
2023-03-13 18:23:46 +08:00
onClicked: {
2024-03-27 00:36:56 +08:00
FluRouter.navigate("/about")
2023-03-13 18:23:46 +08:00
}
}
}
}
2023-04-06 17:32:21 +08:00
CodeExpander{
Layout.fillWidth: true
2024-03-29 16:23:16 +08:00
Layout.topMargin: -6
2023-04-06 17:32:21 +08:00
code:'FluButton{
2024-03-09 15:35:48 +08:00
text: qsTr("Create Window")
2023-04-06 17:32:21 +08:00
onClicked: {
2024-03-27 00:36:56 +08:00
FluRouter.navigate("/about")
2023-04-06 17:32:21 +08:00
}
}
'
}
2023-03-13 18:23:46 +08:00
2024-03-29 16:56:09 +08:00
FluFrame{
2023-04-03 09:32:06 +08:00
Layout.fillWidth: true
2024-03-29 16:23:16 +08:00
Layout.preferredHeight: 130
padding: 10
2023-03-13 18:23:46 +08:00
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{
2024-03-09 15:35:48 +08:00
text: qsTr("Create a window with the parameter username: zhuzichu")
2023-03-13 18:23:46 +08:00
}
FluButton{
2024-03-09 15:35:48 +08:00
text: qsTr("Create Window")
2023-03-13 18:23:46 +08:00
onClicked: {
2024-03-27 00:36:56 +08:00
loginResultLauncher.launch({username:"zhuzichu"})
2023-03-13 18:23:46 +08:00
}
}
2023-03-13 21:18:51 +08:00
FluText{
2024-03-09 15:35:48 +08:00
text:qsTr("Login Window Returned Password - >")+password
2023-03-13 21:18:51 +08:00
}
2023-03-13 18:23:46 +08:00
}
}
2023-04-06 17:32:21 +08:00
CodeExpander{
Layout.fillWidth: true
2024-03-29 16:23:16 +08:00
Layout.topMargin: -6
2024-03-27 10:52:47 +08:00
code:'FluWindowResultLauncher{
id:loginResultLauncher
path: "/login"
onResult:
(data)=>{
password = data.password
}
2023-04-06 17:32:21 +08:00
}
FluButton{
2024-03-09 15:35:48 +08:00
text: qsTr("Create Window")
2023-04-06 17:32:21 +08:00
onClicked: {
2024-03-27 10:52:47 +08:00
loginResultLauncher.launch({username:"zhuzichu"})
2023-04-06 17:32:21 +08:00
}
}
'
}
2023-03-13 18:23:46 +08:00
}