From 2d2f991128f5ecb4d1871d1671e587668fa2bd5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Fri, 15 Mar 2024 22:00:47 +0800 Subject: [PATCH] update --- src/FluFramelessHelper.cpp | 23 +++++++++++++++++++ .../imports/FluentUI/Controls/FluExpander.qml | 3 ++- .../imports/FluentUI/Controls/FluExpander.qml | 3 ++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/FluFramelessHelper.cpp b/src/FluFramelessHelper.cpp index cabe659e..cfa3bd27 100644 --- a/src/FluFramelessHelper.cpp +++ b/src/FluFramelessHelper.cpp @@ -34,6 +34,26 @@ static inline bool isCompositionEnabled(){ } return false; } + +static inline void showShadow(HWND hwnd){ + if(isCompositionEnabled()){ + const MARGINS shadow = { 0, 0, 1, 0 }; + typedef HRESULT (WINAPI* DwmExtendFrameIntoClientAreaPtr)(HWND hWnd, const MARGINS *pMarInset); + HMODULE module = LoadLibraryW(L"dwmapi.dll"); + if (module) + { + DwmExtendFrameIntoClientAreaPtr dwm_extendframe_into_client_area_; + dwm_extendframe_into_client_area_= reinterpret_cast(GetProcAddress(module, "DwmExtendFrameIntoClientArea")); + if (dwm_extendframe_into_client_area_) + { + dwm_extendframe_into_client_area_(hwnd, &shadow); + } + } + }else{ + ULONG_PTR cNewStyle = GetClassLongPtr(hwnd, GCL_STYLE) | CS_DROPSHADOW; + SetClassLongPtr(hwnd, GCL_STYLE, cNewStyle); + } +} #endif FramelessEventFilter::FramelessEventFilter(FluFramelessHelper* helper){ @@ -322,6 +342,9 @@ void FluFramelessHelper::componentComplete(){ _appBar.value()->setProperty("systemMoveEnable",false); } window->setFlags((window->flags()) | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint | Qt::FramelessWindowHint); + if(FluTools::getInstance()->isSoftware() && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)){ + window->setFlag(Qt::FramelessWindowHint,false); + } if(resizeable()){ window->setFlag(Qt::WindowMaximizeButtonHint); } diff --git a/src/Qt5/imports/FluentUI/Controls/FluExpander.qml b/src/Qt5/imports/FluentUI/Controls/FluExpander.qml index 32a34e49..a2ebd399 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluExpander.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluExpander.qml @@ -20,6 +20,7 @@ Item { d.flag = false } } + clip: true Rectangle{ id:layout_header width: parent.width @@ -79,10 +80,10 @@ Item { topMargin: -1 left: layout_header.left } - clip: true visible: contentHeight+container.anchors.topMargin !== 0 height: contentHeight+container.anchors.topMargin width: parent.width + z:-999 Rectangle{ id:container anchors.fill: parent diff --git a/src/Qt6/imports/FluentUI/Controls/FluExpander.qml b/src/Qt6/imports/FluentUI/Controls/FluExpander.qml index aa7d2917..b2230a70 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluExpander.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluExpander.qml @@ -20,6 +20,7 @@ Item { d.flag = false } } + clip: true Rectangle{ id:layout_header width: parent.width @@ -79,10 +80,10 @@ Item { topMargin: -1 left: layout_header.left } - clip: true visible: contentHeight+container.anchors.topMargin !== 0 height: contentHeight+container.anchors.topMargin width: parent.width + z:-999 Rectangle{ id:container anchors.fill: parent