| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2017 The Qt Company Ltd. |
| 4 | ** Contact: http://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the Qt3D module of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL3$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see http://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at http://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU Lesser General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the |
| 21 | ** packaging of this file. Please review the following information to |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. |
| 24 | ** |
| 25 | ** GNU General Public License Usage |
| 26 | ** Alternatively, this file may be used under the terms of the GNU |
| 27 | ** General Public License version 2.0 or later as published by the Free |
| 28 | ** Software Foundation and appearing in the file LICENSE.GPL included in |
| 29 | ** the packaging of this file. Please review the following information to |
| 30 | ** ensure the GNU General Public License version 2.0 requirements will be |
| 31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. |
| 32 | ** |
| 33 | ** $QT_END_LICENSE$ |
| 34 | ** |
| 35 | ****************************************************************************/ |
| 36 | |
| 37 | #ifndef QT3DRENDER_QUICK3DSCENE2D_QSCENE2D_H |
| 38 | #define QT3DRENDER_QUICK3DSCENE2D_QSCENE2D_H |
| 39 | |
| 40 | #include <Qt3DQuickScene2D/qt3dquickscene2d_global.h> |
| 41 | #include <Qt3DRender/qrendertargetoutput.h> |
| 42 | |
| 43 | #include <QtCore/QUrl> |
| 44 | #include <QtCore/QEvent> |
| 45 | |
| 46 | #include <Qt3DCore/qnode.h> |
| 47 | |
| 48 | #include <QtQuick/qquickitem.h> |
| 49 | |
| 50 | QT_BEGIN_NAMESPACE |
| 51 | |
| 52 | namespace Qt3DRender { |
| 53 | |
| 54 | namespace Quick { |
| 55 | |
| 56 | class QScene2DPrivate; |
| 57 | |
| 58 | class Q_3DQUICKSCENE2DSHARED_EXPORT QScene2D : public Qt3DCore::QNode |
| 59 | { |
| 60 | Q_OBJECT |
| 61 | |
| 62 | Q_PROPERTY(Qt3DRender::QRenderTargetOutput *output READ output WRITE setOutput NOTIFY outputChanged) |
| 63 | Q_PROPERTY(RenderPolicy renderPolicy READ renderPolicy WRITE setRenderPolicy NOTIFY renderPolicyChanged) |
| 64 | Q_PROPERTY(QQuickItem *item READ item WRITE setItem NOTIFY itemChanged) |
| 65 | Q_PROPERTY(bool mouseEnabled READ isMouseEnabled WRITE setMouseEnabled NOTIFY mouseEnabledChanged) |
| 66 | |
| 67 | Q_CLASSINFO("DefaultProperty" , "item" ) |
| 68 | |
| 69 | public: |
| 70 | |
| 71 | enum RenderPolicy { |
| 72 | Continuous, |
| 73 | SingleShot |
| 74 | }; |
| 75 | Q_ENUM(RenderPolicy) |
| 76 | |
| 77 | explicit QScene2D(Qt3DCore::QNode *parent = nullptr); |
| 78 | |
| 79 | Qt3DRender::QRenderTargetOutput *output() const; |
| 80 | QScene2D::RenderPolicy renderPolicy() const; |
| 81 | QQuickItem *item() const; |
| 82 | bool isMouseEnabled() const; |
| 83 | |
| 84 | Q_DECL_DEPRECATED QVector<Qt3DCore::QEntity *> entities(); |
| 85 | QVector<Qt3DCore::QEntity *> entities() const; |
| 86 | void addEntity(Qt3DCore::QEntity *entity); |
| 87 | void removeEntity(Qt3DCore::QEntity *entity); |
| 88 | |
| 89 | public Q_SLOTS: |
| 90 | void setOutput(Qt3DRender::QRenderTargetOutput *output); |
| 91 | void setRenderPolicy(QScene2D::RenderPolicy policy); |
| 92 | void setItem(QQuickItem *item); |
| 93 | void setMouseEnabled(bool enabled); |
| 94 | |
| 95 | Q_SIGNALS: |
| 96 | void outputChanged(Qt3DRender::QRenderTargetOutput *output); |
| 97 | void renderPolicyChanged(QScene2D::RenderPolicy policy); |
| 98 | void itemChanged(QQuickItem *item); |
| 99 | void mouseEnabledChanged(bool enabled); |
| 100 | |
| 101 | protected: |
| 102 | Q_DECLARE_PRIVATE(QScene2D) |
| 103 | |
| 104 | private: |
| 105 | Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const override; |
| 106 | }; |
| 107 | |
| 108 | } // namespace Quick |
| 109 | } // namespace Qt3DRender |
| 110 | |
| 111 | QT_END_NAMESPACE |
| 112 | |
| 113 | #endif // QT3DRENDER_QUICK3DSCENE2D_QSCENE2D_H |
| 114 | |