From 38612f0ebc20d49767edc2c8abac19f535bd0c75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Wed, 28 Feb 2024 17:37:53 +0800 Subject: [PATCH] fix bug #440 --- .../imports/FluentUI/Controls/FluWindow.qml | 43 +++++++++++-------- .../imports/FluentUI/Controls/FluWindow.qml | 43 +++++++++++-------- 2 files changed, 48 insertions(+), 38 deletions(-) diff --git a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml index 59d94b7b..771c2ab9 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml @@ -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 - moveWindowToDesktopCenter() + 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,7 +128,9 @@ Window { id:com_frameless_helper FluFramelessHelper{ onLoadCompleted:{ - window.moveWindowToDesktopCenter() + if(autoCenter){ + window.moveWindowToDesktopCenter() + } } } } @@ -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() diff --git a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml index 84ce1f68..22d42028 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml @@ -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 - moveWindowToDesktopCenter() + 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,7 +127,9 @@ Window { id:com_frameless_helper FluFramelessHelper{ onLoadCompleted:{ - window.moveWindowToDesktopCenter() + if(autoCenter){ + window.moveWindowToDesktopCenter() + } } } } @@ -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()