This commit is contained in:
朱子楚\zhuzi
2023-04-11 23:12:31 +08:00
parent c26fdfaee3
commit 5afd2ec518
20 changed files with 216 additions and 659 deletions

View File

@ -1,46 +1,23 @@
import QtQuick
import QtQuick.Window
import QtQuick.Controls
import QtQuick.Layouts
import FluentUI
Item {
ApplicationWindow {
property string title: "FluentUI"
property int minimumWidth
property int maximumWidth
property int minimumHeight
property int maximumHeight
property int modality:0
signal initArgument(var argument)
property var pageRegister
id:window
default property alias content: container.data
property var window : {
if(Window.window == null)
return null
return Window.window
}
property color color: {
if(window && window.active){
return FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(238/255,244/255,249/255,1)
property var argument:({})
property var pageRegister
signal initArgument(var argument)
background: Rectangle{
color: {
if(active){
return FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(238/255,244/255,249/255,1)
}
return FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1)
}
return FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1)
}
id:root
Behavior on opacity{
NumberAnimation{
duration: 100
}
}
Rectangle{
id:container
color:root.color
anchors.fill: parent
anchors.margins: (window && (window.visibility === Window.Maximized) && FluTheme.frameless) ? 8/Screen.devicePixelRatio : 0
clip: true
Behavior on color{
ColorAnimation {
duration: 300
@ -48,47 +25,31 @@ Item {
}
}
Rectangle{
border.width: 1
Item{
id:container
anchors.fill: parent
color: Qt.rgba(0,0,0,0,)
border.color:FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,230/255,234/255,1)
anchors.margins: window.visibility === Window.Maximized && FluTheme.frameless ? 8/Screen.devicePixelRatio : 0
clip: true
}
Connections{
target: FluApp
function onWindowReady(view){
if(FluApp.equalsWindow(view,window)){
helper.initWindow(view)
initArgument(helper.getArgument())
pageRegister = helper.getPageRegister()
helper.setTitle(title)
if(minimumWidth){
helper.setMinimumWidth(minimumWidth)
}
if(maximumWidth){
helper.setMaximumWidth(maximumWidth)
}
if(minimumHeight){
helper.setMinimumHeight(minimumHeight)
}
if(maximumHeight){
helper.setMaximumHeight(maximumHeight)
}
helper.setModality(root.modality);
helper.updateWindow()
}
onClosing:
(event)=>{
//销毁窗口,释放资源
helper.destoryWindow()
}
FluInfoBar{
id:infoBar
root: window
}
WindowHelper{
id:helper
}
FluInfoBar{
id:infoBar
root: root
Component.onCompleted: {
helper.initWindow(window)
initArgument(argument)
}
function showSuccess(text,duration,moremsg){
@ -107,10 +68,6 @@ Item {
infoBar.showError(text,duration,moremsg);
}
function close(){
window.close()
}
function registerForPageResult(path){
return helper.createRegister(path)
}