This commit is contained in:
zhuzihcu 2023-04-13 18:10:38 +08:00
parent ab0fcf5d9c
commit 727a0220b4
6 changed files with 194 additions and 0 deletions

View File

@ -20,6 +20,9 @@ Window {
"/login":"qrc:/page/LoginPage.qml", "/login":"qrc:/page/LoginPage.qml",
"/chat":"qrc:/page/ChatPage.qml", "/chat":"qrc:/page/ChatPage.qml",
"/media":"qrc:/page/MediaPage.qml", "/media":"qrc:/page/MediaPage.qml",
"/singleTaskWindow":"qrc:/page/SingleTaskWindow.qml",
"/standardWindow":"qrc:/page/StandardWindow.qml",
"/singleInstanceWindow":"qrc:/page/SingleInstanceWindow.qml"
} }
FluApp.initialRoute = "/" FluApp.initialRoute = "/"
FluApp.run() FluApp.run()

View File

@ -24,6 +24,86 @@ FluScrollablePage{
} }
} }
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
code:'FluWindow{
//launchMode: FluWindow.Standard
//launchMode: FluWindow.SingleTask
launchMode: FluWindow.SingleInstance
}
'
}
FluArea{ FluArea{
Layout.fillWidth: true Layout.fillWidth: true
height: 100 height: 100

View File

@ -0,0 +1,46 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import FluentUI
FluWindow {
id:window
width: 500
height: 600
minimumWidth: 500
minimumHeight: 600
maximumWidth: 500
maximumHeight: 600
launchMode: FluWindow.SingleInstance
title:"SingleInstance"
FluAppBar{
id:appbar
title:"SingleInstance"
width:parent.width
}
FluTextBox{
anchors{
top:parent.top
topMargin:60
horizontalCenter: parent.horizontalCenter
}
}
FluText{
wrapMode: Text.WrapAnywhere
anchors{
left: parent.left
right: parent.right
leftMargin: 20
rightMargin: 20
verticalCenter: parent.verticalCenter
}
text:"我是一个SingleInstance模式的窗口如果我存在我会销毁之前的窗口并创建一个新窗口"
}
}

View File

@ -0,0 +1,31 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import FluentUI
FluWindow {
id:window
width: 500
height: 600
minimumWidth: 500
minimumHeight: 600
maximumWidth: 500
maximumHeight: 600
launchMode: FluWindow.SingleTask
title:"SingleTask"
FluAppBar{
id:appbar
title:"SingleTask"
width:parent.width
}
FluText{
anchors.centerIn: parent
text:"我是一个SingleTask模式的窗口如果我存在我就激活窗口"
}
}

View File

@ -0,0 +1,31 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import FluentUI
FluWindow {
id:window
width: 500
height: 600
minimumWidth: 500
minimumHeight: 600
maximumWidth: 500
maximumHeight: 600
launchMode: FluWindow.Standard
title:"Standard"
FluAppBar{
id:appbar
title:"Standard"
width:parent.width
}
FluText{
anchors.centerIn: parent
text:"我是一个Standard模式的窗口每次我都会创建一个新的窗口"
}
}

View File

@ -162,5 +162,8 @@
<file>global/MainEvent.qml</file> <file>global/MainEvent.qml</file>
<file>res/svg/home.svg</file> <file>res/svg/home.svg</file>
<file>res/svg/home_dark.svg</file> <file>res/svg/home_dark.svg</file>
<file>page/StandardWindow.qml</file>
<file>page/SingleTaskWindow.qml</file>
<file>page/SingleInstanceWindow.qml</file>
</qresource> </qresource>
</RCC> </RCC>