| 1 | // Copyright (C) 2017 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QT3DRENDER_QUICK3DSCENE2D_QSCENE2D_H |
| 5 | #define QT3DRENDER_QUICK3DSCENE2D_QSCENE2D_H |
| 6 | |
| 7 | #include <Qt3DQuickScene2D/qt3dquickscene2d_global.h> |
| 8 | #include <Qt3DRender/qrendertargetoutput.h> |
| 9 | |
| 10 | #include <QtCore/QUrl> |
| 11 | #include <QtCore/QEvent> |
| 12 | |
| 13 | #include <Qt3DCore/qentity.h> |
| 14 | |
| 15 | #include <QtQuick/qquickitem.h> |
| 16 | |
| 17 | QT_BEGIN_NAMESPACE |
| 18 | |
| 19 | namespace Qt3DRender { |
| 20 | |
| 21 | namespace Quick { |
| 22 | |
| 23 | class QScene2DPrivate; |
| 24 | |
| 25 | class Q_3DQUICKSCENE2DSHARED_EXPORT QScene2D : public Qt3DCore::QNode |
| 26 | { |
| 27 | Q_OBJECT |
| 28 | |
| 29 | Q_PROPERTY(Qt3DRender::QRenderTargetOutput *output READ output WRITE setOutput NOTIFY outputChanged) |
| 30 | Q_PROPERTY(RenderPolicy renderPolicy READ renderPolicy WRITE setRenderPolicy NOTIFY renderPolicyChanged) |
| 31 | Q_PROPERTY(QQuickItem *item READ item WRITE setItem NOTIFY itemChanged) |
| 32 | Q_PROPERTY(bool mouseEnabled READ isMouseEnabled WRITE setMouseEnabled NOTIFY mouseEnabledChanged) |
| 33 | |
| 34 | Q_CLASSINFO("DefaultProperty" , "item" ) |
| 35 | |
| 36 | public: |
| 37 | |
| 38 | enum RenderPolicy { |
| 39 | Continuous, |
| 40 | SingleShot |
| 41 | }; |
| 42 | Q_ENUM(RenderPolicy) |
| 43 | |
| 44 | explicit QScene2D(Qt3DCore::QNode *parent = nullptr); |
| 45 | |
| 46 | Qt3DRender::QRenderTargetOutput *output() const; |
| 47 | QScene2D::RenderPolicy renderPolicy() const; |
| 48 | QQuickItem *item() const; |
| 49 | bool isMouseEnabled() const; |
| 50 | |
| 51 | QList<Qt3DCore::QEntity *> entities() const; |
| 52 | void addEntity(Qt3DCore::QEntity *entity); |
| 53 | void removeEntity(Qt3DCore::QEntity *entity); |
| 54 | |
| 55 | public Q_SLOTS: |
| 56 | void setOutput(Qt3DRender::QRenderTargetOutput *output); |
| 57 | void setRenderPolicy(QScene2D::RenderPolicy policy); |
| 58 | void setItem(QQuickItem *item); |
| 59 | void setMouseEnabled(bool enabled); |
| 60 | |
| 61 | Q_SIGNALS: |
| 62 | void outputChanged(Qt3DRender::QRenderTargetOutput *output); |
| 63 | void renderPolicyChanged(QScene2D::RenderPolicy policy); |
| 64 | void itemChanged(QQuickItem *item); |
| 65 | void mouseEnabledChanged(bool enabled); |
| 66 | |
| 67 | protected: |
| 68 | Q_DECLARE_PRIVATE(QScene2D) |
| 69 | }; |
| 70 | |
| 71 | } // namespace Quick |
| 72 | } // namespace Qt3DRender |
| 73 | |
| 74 | QT_END_NAMESPACE |
| 75 | |
| 76 | #endif // QT3DRENDER_QUICK3DSCENE2D_QSCENE2D_H |
| 77 | |