1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QSSGITEM2D_H
5#define QSSGITEM2D_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuick3D/private/qquick3dnode_p.h>
19#include <QtQuick3D/private/qquick3dscenemanager_p.h>
20#include <QtQuick/private/qquickitemchangelistener_p.h>
21#include <QtQuick/QSGNode>
22#include <QtCore/QPointer>
23#include <QtCore/QVector>
24
25QT_BEGIN_NAMESPACE
26
27class QSGLayer;
28class QSGRenderer;
29class QSGRootNode;
30class QQuickRootItem;
31class Q_AUTOTEST_EXPORT QQuick3DItem2D : public QQuick3DNode, public QQuickItemChangeListener
32{
33 Q_OBJECT
34public:
35 explicit QQuick3DItem2D(QQuickItem* item, QQuick3DNode *parent = nullptr);
36 ~QQuick3DItem2D() override;
37
38 void addChildItem(QQuickItem *item);
39 void removeChildItem(QQuickItem *item);
40 QQuickItem *contentItem() const;
41 void itemDestroyed(QQuickItem *item) override;
42
43private Q_SLOTS:
44 void invalidated();
45 void updatePicking();
46 void derefWindow(QObject *win);
47
48Q_SIGNALS:
49 void allChildrenRemoved();
50
51protected:
52 void preSync() override;
53
54private:
55 QSSGRenderGraphObject *updateSpatialNode(QSSGRenderGraphObject *node) override;
56 void markAllDirty() override;
57
58 QVector<QQuickItem *> m_sourceItems;
59 QSGRenderer *m_renderer = nullptr;
60 QSGRootNode *m_rootNode = nullptr;
61 QQuickWindow *m_window = nullptr;
62 QQuickItem *m_contentItem = nullptr;
63 bool m_pickingDirty = true;
64 QPointer<QQuick3DSceneManager> m_sceneManagerForLayer;
65};
66
67QT_END_NAMESPACE
68
69#endif // QSSGITEM2D_H
70

source code of qtquick3d/src/quick3d/qquick3ditem2d_p.h