Krita Source Code Documentation
Loading...
Searching...
No Matches
KisRootSurfaceTrackerBase.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6#ifndef KISROOTSURFACETRACKERBASE_H
7#define KISROOTSURFACETRACKERBASE_H
8
9#include <kritawidgetutils_export.h>
10
11#include <QObject>
12#include <QPointer>
13
14class QWidget;
15class QWindow;
16class QEvent;
17
37class KRITAWIDGETUTILS_EXPORT KisRootSurfaceTrackerBase : public QObject
38{
39 Q_OBJECT
40public:
41 KisRootSurfaceTrackerBase(QWidget *watched, QObject *parent = nullptr);
43
44 QWidget* trackedWidget() const;
45
46protected:
47 virtual void connectToNativeWindow(QWindow *nativeWindow) = 0;
48 virtual void disconnectFromNativeWindow() = 0;
49 void initialize();
50
51private:
52
53 bool eventFilter(QObject *watched, QEvent *event) override;
54
55 void tryUpdateHierarchy();
56 void tryReconnectToNativeWindow();
57
58 QVector<QPointer<QObject>> getCurrentHierarchy(QWidget *wdg);
59
60 void reconnectToHierarchy(const QVector<QPointer<QObject>> newHierarchy);
61
62private:
63 QWidget *m_watched {nullptr};
65
67
70};
71
72#endif /* KISROOTSURFACETRACKERBASE_H */
QPointer< QWindow > m_topLevelNativeWindow
virtual void disconnectFromNativeWindow()=0
virtual void connectToNativeWindow(QWindow *nativeWindow)=0
QPointer< QWidget > m_topLevelWidgetWithSurface
QVector< QPointer< QObject > > m_watchedHierarchy