From c4cf4c13b8603237416dd291abbb66bc735938e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Sun, 17 Mar 2024 11:17:59 +0800 Subject: [PATCH] update --- src/FluFramelessHelper.cpp | 22 ++----------------- .../FluentUI/Controls/FluTableView.qml | 9 ++++---- .../FluentUI/Controls/FluTableView.qml | 11 +++++----- 3 files changed, 13 insertions(+), 29 deletions(-) diff --git a/src/FluFramelessHelper.cpp b/src/FluFramelessHelper.cpp index 32dca883..68521569 100644 --- a/src/FluFramelessHelper.cpp +++ b/src/FluFramelessHelper.cpp @@ -35,25 +35,6 @@ 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){ @@ -218,6 +199,8 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void * if(wParam == SC_MINIMIZE){ if(_helper->window->transientParent()){ _helper->window->transientParent()->showMinimized(); + }else{ + _helper->window->showMinimized(); } return true; } @@ -231,7 +214,6 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void * FluFramelessHelper::FluFramelessHelper(QObject *parent) : QObject{parent} { - } void FluFramelessHelper::classBegin(){ diff --git a/src/Qt5/imports/FluentUI/Controls/FluTableView.qml b/src/Qt5/imports/FluentUI/Controls/FluTableView.qml index c6f0ad10..7a3e286f 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluTableView.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluTableView.qml @@ -304,16 +304,17 @@ Rectangle { property var display: itemModel.display property int row: item_table.position.y property int column: item_table.position.x + property bool isObject: typeof(display) == "object" property var options: { - if(typeof(modelData) == "object"){ - return modelData.options + if(isObject){ + return display.options } return {} } anchors.fill: parent sourceComponent: { - if(typeof(modelData) == "object"){ - return modelData.comId + if(isObject){ + return display.comId } return com_text } diff --git a/src/Qt6/imports/FluentUI/Controls/FluTableView.qml b/src/Qt6/imports/FluentUI/Controls/FluTableView.qml index 974fc0d7..4d1e512c 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluTableView.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluTableView.qml @@ -142,7 +142,7 @@ Rectangle { id:com_text FluText { id:item_text - text: String(display) + text: display elide: Text.ElideRight wrapMode: Text.WrapAnywhere anchors{ @@ -306,16 +306,17 @@ Rectangle { property var display: itemModel.display property int row: item_table.position.y property int column: item_table.position.x + property bool isObject: typeof(display) == "object" property var options: { - if(typeof(modelData) == "object"){ - return modelData.options + if(isObject){ + return display.options } return {} } anchors.fill: parent sourceComponent: { - if(typeof(modelData) == "object"){ - return modelData.comId + if(isObject){ + return display.comId } return com_text }