This commit is contained in:
zhuzichu 2023-11-27 15:29:54 +08:00
parent 2242ffc367
commit 5dd3320f66
2 changed files with 22 additions and 4 deletions

View File

@ -39,6 +39,7 @@ Window {
property bool showMaximize: true property bool showMaximize: true
property bool showStayTop: true property bool showStayTop: true
property bool useSystemAppBar property bool useSystemAppBar
property bool autoMaximize: false
property var closeListener: function(event){ property var closeListener: function(event){
if(closeDestory){ if(closeDestory){
destoryOnClose() destoryOnClose()
@ -64,7 +65,11 @@ Window {
d.changedStayTop() d.changedStayTop()
if(useSystemAppBar){ if(useSystemAppBar){
window.moveWindowToDesktopCenter() window.moveWindowToDesktopCenter()
window.visible = true if(window.autoMaximize){
window.showMaximized()
}else{
window.show()
}
} }
} }
Component.onDestruction: { Component.onDestruction: {
@ -224,9 +229,13 @@ Window {
if (blurBehindWindowEnabled) if (blurBehindWindowEnabled)
window.background = undefined window.background = undefined
} }
if(window.autoMaximize){
window.showMaximized()
}else{
window.show() window.show()
} }
} }
}
WindowLifecycle{ WindowLifecycle{
id:lifecycle id:lifecycle
} }

View File

@ -38,6 +38,7 @@ Window {
property bool showMaximize: true property bool showMaximize: true
property bool showStayTop: true property bool showStayTop: true
property bool useSystemAppBar property bool useSystemAppBar
property bool autoMaximize: false
property var closeListener: function(event){ property var closeListener: function(event){
if(closeDestory){ if(closeDestory){
destoryOnClose() destoryOnClose()
@ -63,7 +64,11 @@ Window {
d.changedStayTop() d.changedStayTop()
if(useSystemAppBar){ if(useSystemAppBar){
window.moveWindowToDesktopCenter() window.moveWindowToDesktopCenter()
window.visible = true if(window.autoMaximize){
window.showMaximized()
}else{
window.show()
}
} }
} }
Component.onDestruction: { Component.onDestruction: {
@ -223,9 +228,13 @@ Window {
if (blurBehindWindowEnabled) if (blurBehindWindowEnabled)
window.background = undefined window.background = undefined
} }
if(window.autoMaximize){
window.showMaximized()
}else{
window.show() window.show()
} }
} }
}
WindowLifecycle{ WindowLifecycle{
id:lifecycle id:lifecycle
} }