From 3cfe15a9c3db0993d8b8fef5d148625840e5a75c Mon Sep 17 00:00:00 2001 From: Sine Striker <trueful@163.com> Date: 周二, 05 12月 2023 15:43:39 +0800 Subject: [PATCH] Add host interface --- src/core/contexts/abstractwindowcontext_p.h | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/core/contexts/abstractwindowcontext_p.h b/src/core/contexts/abstractwindowcontext_p.h index a92d91d..996a0e3 100644 --- a/src/core/contexts/abstractwindowcontext_p.h +++ b/src/core/contexts/abstractwindowcontext_p.h @@ -16,14 +16,14 @@ class QWK_CORE_EXPORT AbstractWindowContext : public QObject { Q_OBJECT public: - AbstractWindowContext(QWindow *window, WindowItemDelegate *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); @@ -42,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; @@ -56,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