FluentUI/example/qml/page/T_MultiWindow.qml
朱子楚\zhuzi 6a5f9d04a9 update
2024-03-29 16:56:09 +08:00

186 lines
4.5 KiB
QML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import FluentUI 1.0
import "../component"
FluScrollablePage{
property string password: ""
title: qsTr("MultiWindow")
FluWindowResultLauncher{
id:loginResultLauncher
path: "/login"
onResult:
(data)=>{
password = data.password
}
}
FluFrame{
Layout.fillWidth: true
Layout.preferredHeight: 86
padding: 10
Column{
spacing: 15
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
FluText{
text: qsTr("<font color='red'>Standard</font> mode windowa new window is created every time")
}
FluButton{
text: qsTr("Create Window")
onClicked: {
FluRouter.navigate("/standardWindow")
}
}
}
}
FluFrame{
Layout.fillWidth: true
Layout.preferredHeight: 86
padding: 10
Layout.topMargin: 10
Column{
spacing: 15
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
FluText{
text: qsTr("<font color='red'>SingleTask</font> mode windowIf a window exists, this activates the window")
textFormat: Text.RichText
}
FluButton{
text: qsTr("Create Window")
onClicked: {
FluRouter.navigate("/singleTaskWindow")
}
}
}
}
FluFrame{
Layout.fillWidth: true
Layout.preferredHeight: 86
padding: 10
Layout.topMargin: 10
Column{
spacing: 15
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
FluText{
text: qsTr("<font color='red'>SingleInstance</font> mode windowIf the window exists, destroy the window and create a new window")
}
FluButton{
text: qsTr("Create Window")
onClicked: {
FluRouter.navigate("/singleInstanceWindow")
}
}
}
}
CodeExpander{
Layout.fillWidth: true
Layout.topMargin: -6
code:'FluWindow{
//launchMode: FluWindowType.Standard
//launchMode: FluWindowType.SingleTask
launchMode: FluWindowType.SingleInstance
}
'
}
FluFrame{
Layout.fillWidth: true
Layout.preferredHeight: 100
padding: 10
Layout.topMargin: 20
Column{
spacing: 15
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
FluText{
text: qsTr("Create the window without carrying any parameters")
}
FluButton{
text: qsTr("Create Window")
onClicked: {
FluRouter.navigate("/about")
}
}
}
}
CodeExpander{
Layout.fillWidth: true
Layout.topMargin: -6
code:'FluButton{
text: qsTr("Create Window")
onClicked: {
FluRouter.navigate("/about")
}
}
'
}
FluFrame{
Layout.fillWidth: true
Layout.preferredHeight: 130
padding: 10
Layout.topMargin: 20
Column{
spacing: 15
anchors{
verticalCenter: parent.verticalCenter
left: parent.left
}
FluText{
text: qsTr("Create a window with the parameter username: zhuzichu")
}
FluButton{
text: qsTr("Create Window")
onClicked: {
loginResultLauncher.launch({username:"zhuzichu"})
}
}
FluText{
text:qsTr("Login Window Returned Password - >")+password
}
}
}
CodeExpander{
Layout.fillWidth: true
Layout.topMargin: -6
code:'FluWindowResultLauncher{
id:loginResultLauncher
path: "/login"
onResult:
(data)=>{
password = data.password
}
}
FluButton{
text: qsTr("Create Window")
onClicked: {
loginResultLauncher.launch({username:"zhuzichu"})
}
}
'
}
}