This commit is contained in:
朱子楚\zhuzi 2024-02-28 17:37:53 +08:00
parent 4f2fcd8865
commit 38612f0ebc
2 changed files with 48 additions and 38 deletions

View File

@ -40,6 +40,7 @@ Window {
property bool showStayTop: true
property bool autoMaximize: false
property bool autoVisible: true
property bool autoCenter: true
property bool useSystemAppBar
property color resizeBorderColor: {
if(window.active){
@ -69,11 +70,13 @@ Window {
Component.onCompleted: {
_realHeight = height
_realWidth = width
useSystemAppBar = FluApp.useSystemAppBar
if(useSystemAppBar && autoCenter){
moveWindowToDesktopCenter()
}
fixWindowSize()
lifecycle.onCompleted(window)
initArgument(argument)
useSystemAppBar = FluApp.useSystemAppBar
if(!useSystemAppBar){
loader_frameless_helper.sourceComponent = com_frameless_helper
}
@ -125,10 +128,12 @@ Window {
id:com_frameless_helper
FluFramelessHelper{
onLoadCompleted:{
if(autoCenter){
window.moveWindowToDesktopCenter()
}
}
}
}
Component{
id:com_background
Rectangle{
@ -265,22 +270,22 @@ Window {
FluWindowLifecycle{
id:lifecycle
}
// FluLoader{
// id:loader_border
// anchors.fill: parent
// sourceComponent: {
// if(window.useSystemAppBar){
// return undefined
// }
// if(FluTools.isWindows10OrGreater()){
// return undefined
// }
// if(window.visibility == Window.Maximized || window.visibility == Window.FullScreen){
// return undefined
// }
// return com_border
// }
// }
FluLoader{
id:loader_border
anchors.fill: parent
sourceComponent: {
if(window.useSystemAppBar){
return undefined
}
if(FluTools.isWindows10OrGreater()){
return undefined
}
if(window.visibility == Window.Maximized || window.visibility == Window.FullScreen){
return undefined
}
return com_border
}
}
}
function destoryOnClose(){
lifecycle.onDestoryOnClose()

View File

@ -39,6 +39,7 @@ Window {
property bool showStayTop: true
property bool autoMaximize: false
property bool autoVisible: true
property bool autoCenter: true
property bool useSystemAppBar
property color resizeBorderColor: {
if(window.active){
@ -68,11 +69,13 @@ Window {
Component.onCompleted: {
_realHeight = height
_realWidth = width
useSystemAppBar = FluApp.useSystemAppBar
if(useSystemAppBar && autoCenter){
moveWindowToDesktopCenter()
}
fixWindowSize()
lifecycle.onCompleted(window)
initArgument(argument)
useSystemAppBar = FluApp.useSystemAppBar
if(!useSystemAppBar){
loader_frameless_helper.sourceComponent = com_frameless_helper
}
@ -124,10 +127,12 @@ Window {
id:com_frameless_helper
FluFramelessHelper{
onLoadCompleted:{
if(autoCenter){
window.moveWindowToDesktopCenter()
}
}
}
}
Component{
id:com_background
Rectangle{
@ -264,22 +269,22 @@ Window {
FluWindowLifecycle{
id:lifecycle
}
// FluLoader{
// id:loader_border
// anchors.fill: parent
// sourceComponent: {
// if(window.useSystemAppBar){
// return undefined
// }
// if(FluTools.isWindows10OrGreater()){
// return undefined
// }
// if(window.visibility == Window.Maximized || window.visibility == Window.FullScreen){
// return undefined
// }
// return com_border
// }
// }
FluLoader{
id:loader_border
anchors.fill: parent
sourceComponent: {
if(window.useSystemAppBar){
return undefined
}
if(FluTools.isWindows10OrGreater()){
return undefined
}
if(window.visibility == Window.Maximized || window.visibility == Window.FullScreen){
return undefined
}
return com_border
}
}
}
function destoryOnClose(){
lifecycle.onDestoryOnClose()