From 9dcea027f16c4ce5852da3dfc8aca284c582bd7d Mon Sep 17 00:00:00 2001
From: sola.lu <sola.lu.greentest.com.cn>
Date: 周五, 06 6月 2025 18:19:18 +0800
Subject: [PATCH] 1.注释掉custom margin,解决程序放大后,遮盖窗口底部内容的问题。

---
 src/widgets/widgetitemdelegate.cpp |   48 ++++++++++++++++++++++++++++++++----------------
 1 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/src/widgets/widgetitemdelegate.cpp b/src/widgets/widgetitemdelegate.cpp
index e1ff752..b1b7f6c 100644
--- a/src/widgets/widgetitemdelegate.cpp
+++ b/src/widgets/widgetitemdelegate.cpp
@@ -5,12 +5,37 @@
 #include "widgetitemdelegate_p.h"
 
 #include <QtGui/QMouseEvent>
-#include <QtWidgets/QWidget>
 #include <QtWidgets/QApplication>
+#include <QtWidgets/QWidget>
+
+#include <QWKCore/private/abstractwindowcontext_p.h>
 
 extern Q_DECL_IMPORT QWidget *qt_button_down;
 
 namespace QWK {
+
+    class WidgetWinIdChangeEventFilter : public WinIdChangeEventFilter {
+    public:
+        explicit WidgetWinIdChangeEventFilter(QObject *host, AbstractWindowContext *ctx)
+            : WinIdChangeEventFilter(host, ctx), widget(static_cast<QWidget *>(host)) {
+            widget->installEventFilter(this);
+        }
+
+        WId winId() const override {
+            return widget->effectiveWinId();
+        }
+
+    protected:
+        bool eventFilter(QObject *obj, QEvent *event) override {
+            Q_UNUSED(obj)
+            if (event->type() == QEvent::WinIdChange) {
+                context->notifyWinIdChange();
+            }
+            return false;
+        }
+
+        QWidget *widget;
+    };
 
     WidgetItemDelegate::WidgetItemDelegate() = default;
 
@@ -37,21 +62,6 @@
 
     QWindow *WidgetItemDelegate::hostWindow(const QObject *host) const {
         return static_cast<const QWidget *>(host)->windowHandle();
-    }
-
-    bool WidgetItemDelegate::isHostSizeFixed(const QObject *host) const {
-        const auto widget = static_cast<const QWidget *>(host);
-        // "Qt::MSWindowsFixedSizeDialogHint" is used cross-platform actually.
-        if (widget->windowFlags() & Qt::MSWindowsFixedSizeDialogHint) {
-            return true;
-        }
-        // Caused by setFixedWidth/Height/Size().
-        const QSize minSize = widget->minimumSize();
-        const QSize maxSize = widget->maximumSize();
-        if (!minSize.isEmpty() && !maxSize.isEmpty() && (minSize == maxSize)) {
-            return true;
-        }
-        return false;
     }
 
     bool WidgetItemDelegate::isWindowActive(const QObject *host) const {
@@ -112,4 +122,10 @@
         static_cast<QWidget *>(host)->raise();
     }
 
+    WinIdChangeEventFilter *
+        WidgetItemDelegate::createWinIdEventFilter(QObject *host,
+                                                   AbstractWindowContext *context) const {
+        return new WidgetWinIdChangeEventFilter(host, context);
+    }
+
 }
\ No newline at end of file

--
Gitblit v1.9.1