diff --git a/example/qml-Qt6/page/T_Settings.qml b/example/qml-Qt6/page/T_Settings.qml index 04e7d0a7..5668e737 100644 --- a/example/qml-Qt6/page/T_Settings.qml +++ b/example/qml-Qt6/page/T_Settings.qml @@ -67,7 +67,6 @@ FluScrollablePage{ anchors.verticalCenter: parent.verticalCenter onClicked: { FluApp.useSystemAppBar = !FluApp.useSystemAppBar - dialog_restart.open() } } } diff --git a/example/qml/page/T_Settings.qml b/example/qml/page/T_Settings.qml index d61429c0..b1390e64 100644 --- a/example/qml/page/T_Settings.qml +++ b/example/qml/page/T_Settings.qml @@ -70,7 +70,6 @@ FluScrollablePage{ anchors.verticalCenter: parent.verticalCenter onClicked: { FluApp.useSystemAppBar = !FluApp.useSystemAppBar - dialog_restart.open() } } } diff --git a/src/FluFramelessHelper.cpp b/src/FluFramelessHelper.cpp index e31ad179..d412761e 100644 --- a/src/FluFramelessHelper.cpp +++ b/src/FluFramelessHelper.cpp @@ -358,6 +358,16 @@ FluFramelessHelper::~FluFramelessHelper(){ if(isCompositionEnabled()){ qApp->removeNativeEventFilter(_nativeEvent); delete _nativeEvent; + HWND hwnd = reinterpret_cast(window->winId()); + SetWindowPos(hwnd,nullptr,0,0,0,0,SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); + int w = window->width(); + int h = window->height(); + if(_fixSize.read().toBool()){ + window->setMaximumSize(QSize(w,h)); + window->setMinimumSize(QSize(w,h)); + } + window->setWidth(w); + window->setHeight(h); } #endif window->removeEventFilter(this); diff --git a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml index 1f638728..5548cfd2 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml @@ -39,7 +39,7 @@ Window { property bool showMaximize: true property bool showStayTop: true property bool autoMaximize: false - property bool useSystemAppBar + property bool useSystemAppBar: FluApp.useSystemAppBar property color resizeBorderColor: { if(window.active){ return _accentColor @@ -70,10 +70,9 @@ Window { _realHeight = height _realWidth = width moveWindowToDesktopCenter() - useSystemAppBar = FluApp.useSystemAppBar - if(!useSystemAppBar){ - loader_frameless_helper.sourceComponent = com_frameless - } + loader_frameless_helper.sourceComponent = Qt.binding(function(){ + return window.useSystemAppBar ? undefined : com_frameless + }) lifecycle.onCompleted(window) initArgument(argument) if(window.autoMaximize){ diff --git a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml index d155e186..3284092b 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml @@ -38,7 +38,7 @@ Window { property bool showMaximize: true property bool showStayTop: true property bool autoMaximize: false - property bool useSystemAppBar + property bool useSystemAppBar: FluApp.useSystemAppBar property color resizeBorderColor: { if(window.active){ return _accentColor @@ -69,10 +69,9 @@ Window { _realHeight = height _realWidth = width moveWindowToDesktopCenter() - useSystemAppBar = FluApp.useSystemAppBar - if(!useSystemAppBar){ - loader_frameless_helper.sourceComponent = com_frameless - } + loader_frameless_helper.sourceComponent = Qt.binding(function(){ + return window.useSystemAppBar ? undefined : com_frameless + }) lifecycle.onCompleted(window) initArgument(argument) if(window.autoMaximize){