From 09287f3d9e9e88271de2bfd5388dae5a53e8c6f5 Mon Sep 17 00:00:00 2001 From: Sine Striker <trueful@163.com> Date: ćšć, 07 12æ 2023 15:03:24 +0800 Subject: [PATCH] Add host event filter --- src/core/contexts/abstractwindowcontext_p.h | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/core/contexts/abstractwindowcontext_p.h b/src/core/contexts/abstractwindowcontext_p.h index 127b33d..30ea3c1 100644 --- a/src/core/contexts/abstractwindowcontext_p.h +++ b/src/core/contexts/abstractwindowcontext_p.h @@ -16,13 +16,13 @@ class QWK_CORE_EXPORT AbstractWindowContext : public QObject { Q_OBJECT public: - AbstractWindowContext(const QObject *host, const WindowItemDelegate *delegate); + AbstractWindowContext(); ~AbstractWindowContext() override; public: - virtual bool setup() = 0; + bool setup(QObject *host, WindowItemDelegate *delegate); - inline const QObject *host() const; + inline QObject *host() const; inline QWindow *window() const; inline bool isHitTestVisible(const QObject *obj) const; @@ -42,8 +42,12 @@ bool isInTitleBarDraggableArea(const QPoint &pos) const; protected: - const QObject *m_host; - const WindowItemDelegate *m_delegate; + virtual bool setupHost() = 0; + virtual bool hostEventFilter(QEvent *event); + + protected: + QObject *m_host; + std::unique_ptr<WindowItemDelegate> m_delegate; QWindow *m_windowHandle; QSet<const QObject *> m_hitTestVisibleItems; @@ -57,7 +61,7 @@ mutable QRegion hitTestVisibleShape; }; - inline const QObject *AbstractWindowContext::host() const { + inline QObject *AbstractWindowContext::host() const { return m_host; } -- Gitblit v1.9.1