This commit is contained in:
朱子楚\zhuzi 2024-03-17 11:17:59 +08:00
parent f8dee135a1
commit c4cf4c13b8
3 changed files with 13 additions and 29 deletions

View File

@ -35,25 +35,6 @@ static inline bool isCompositionEnabled(){
return false; 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<DwmExtendFrameIntoClientAreaPtr>(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 #endif
FramelessEventFilter::FramelessEventFilter(FluFramelessHelper* helper){ FramelessEventFilter::FramelessEventFilter(FluFramelessHelper* helper){
@ -218,6 +199,8 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void *
if(wParam == SC_MINIMIZE){ if(wParam == SC_MINIMIZE){
if(_helper->window->transientParent()){ if(_helper->window->transientParent()){
_helper->window->transientParent()->showMinimized(); _helper->window->transientParent()->showMinimized();
}else{
_helper->window->showMinimized();
} }
return true; return true;
} }
@ -231,7 +214,6 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void *
FluFramelessHelper::FluFramelessHelper(QObject *parent) FluFramelessHelper::FluFramelessHelper(QObject *parent)
: QObject{parent} : QObject{parent}
{ {
} }
void FluFramelessHelper::classBegin(){ void FluFramelessHelper::classBegin(){

View File

@ -304,16 +304,17 @@ Rectangle {
property var display: itemModel.display property var display: itemModel.display
property int row: item_table.position.y property int row: item_table.position.y
property int column: item_table.position.x property int column: item_table.position.x
property bool isObject: typeof(display) == "object"
property var options: { property var options: {
if(typeof(modelData) == "object"){ if(isObject){
return modelData.options return display.options
} }
return {} return {}
} }
anchors.fill: parent anchors.fill: parent
sourceComponent: { sourceComponent: {
if(typeof(modelData) == "object"){ if(isObject){
return modelData.comId return display.comId
} }
return com_text return com_text
} }

View File

@ -142,7 +142,7 @@ Rectangle {
id:com_text id:com_text
FluText { FluText {
id:item_text id:item_text
text: String(display) text: display
elide: Text.ElideRight elide: Text.ElideRight
wrapMode: Text.WrapAnywhere wrapMode: Text.WrapAnywhere
anchors{ anchors{
@ -306,16 +306,17 @@ Rectangle {
property var display: itemModel.display property var display: itemModel.display
property int row: item_table.position.y property int row: item_table.position.y
property int column: item_table.position.x property int column: item_table.position.x
property bool isObject: typeof(display) == "object"
property var options: { property var options: {
if(typeof(modelData) == "object"){ if(isObject){
return modelData.options return display.options
} }
return {} return {}
} }
anchors.fill: parent anchors.fill: parent
sourceComponent: { sourceComponent: {
if(typeof(modelData) == "object"){ if(isObject){
return modelData.comId return display.comId
} }
return com_text return com_text
} }