From e9d163b1a811ee4f02e898bc7c2e6336d88e4a7f Mon Sep 17 00:00:00 2001
From: Sine Striker <trueful@163.com>
Date: 周日, 28 7月 2024 18:09:03 +0800
Subject: [PATCH] Make hit-test items auto-delete

---
 src/core/contexts/abstractwindowcontext_p.h |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/core/contexts/abstractwindowcontext_p.h b/src/core/contexts/abstractwindowcontext_p.h
index e2b8f4b..062494d 100644
--- a/src/core/contexts/abstractwindowcontext_p.h
+++ b/src/core/contexts/abstractwindowcontext_p.h
@@ -47,7 +47,7 @@
         inline WindowItemDelegate *delegate() const;
 
         inline bool isHitTestVisible(const QObject *obj) const;
-        bool setHitTestVisible(const QObject *obj, bool visible);
+        bool setHitTestVisible(QObject *obj, bool visible);
 
         inline QObject *systemButton(WindowAgentBase::SystemButton button) const;
         bool setSystemButton(WindowAgentBase::SystemButton button, QObject *obj);
@@ -124,6 +124,13 @@
 
         QVariantHash m_windowAttributes;
         std::unique_ptr<WinIdChangeEventFilter> m_winIdChangeEventFilter;
+        
+        void removeSystemButtonsAndHitTestItems();
+
+    private:
+        void _q_titleBarDistroyed(QObject *obj);
+        void _q_hitTestVisibleItemDestroyed(QObject *obj);
+        void _q_systemButtonDestroyed(QObject *obj);
     };
 
     inline QObject *AbstractWindowContext::host() const {

--
Gitblit v1.9.1