From a0bede6ff6a700a6eea9702c49d378f07de22f63 Mon Sep 17 00:00:00 2001 From: Sine Striker <trueful@163.com> Date: 周三, 06 12月 2023 12:11:37 +0800 Subject: [PATCH] Fix title bar hover bug --- src/core/contexts/abstractwindowcontext_p.h | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/core/contexts/abstractwindowcontext_p.h b/src/core/contexts/abstractwindowcontext_p.h index 54471fe..996a0e3 100644 --- a/src/core/contexts/abstractwindowcontext_p.h +++ b/src/core/contexts/abstractwindowcontext_p.h @@ -16,16 +16,14 @@ class QWK_CORE_EXPORT AbstractWindowContext : public QObject { Q_OBJECT public: - inline AbstractWindowContext(QWindow *window, WindowItemDelegate *delegate) - : m_windowHandle(window), m_delegate(delegate) { - } + AbstractWindowContext(QObject *host, WindowItemDelegate *delegate); ~AbstractWindowContext() override; public: virtual bool setup() = 0; + inline QObject *host() const; inline QWindow *window() const; - void setupWindow(QWindow *window); inline bool isHitTestVisible(QObject *obj) const; bool setHitTestVisible(QObject *obj, bool visible); @@ -44,8 +42,9 @@ bool isInTitleBarDraggableArea(const QPoint &pos) const; protected: - QWindow *m_windowHandle; + QObject *m_host; std::unique_ptr<WindowItemDelegate> m_delegate; + QWindow *m_windowHandle; QSet<QObject *> m_hitTestVisibleItems; QList<QRect> m_hitTestVisibleRects; @@ -58,6 +57,10 @@ mutable QRegion hitTestVisibleShape; }; + inline QObject *AbstractWindowContext::host() const { + return m_host; + } + inline QWindow *AbstractWindowContext::window() const { return m_windowHandle; } -- Gitblit v1.9.1