| 1 | // Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). |
| 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_QTEXTUREIMAGE_H |
| 5 | #define QT3DRENDER_QTEXTUREIMAGE_H |
| 6 | |
| 7 | #include <QtCore/QUrl> |
| 8 | #include <Qt3DRender/qabstracttextureimage.h> |
| 9 | |
| 10 | QT_BEGIN_NAMESPACE |
| 11 | |
| 12 | namespace Qt3DRender { |
| 13 | |
| 14 | class QTextureImagePrivate; |
| 15 | |
| 16 | class Q_3DRENDERSHARED_EXPORT QTextureImage : public QAbstractTextureImage |
| 17 | { |
| 18 | Q_OBJECT |
| 19 | Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) |
| 20 | Q_PROPERTY(Status status READ status NOTIFY statusChanged) |
| 21 | Q_PROPERTY(bool mirrored READ isMirrored WRITE setMirrored NOTIFY mirroredChanged) |
| 22 | |
| 23 | public: |
| 24 | explicit QTextureImage(Qt3DCore::QNode *parent = nullptr); |
| 25 | ~QTextureImage(); |
| 26 | |
| 27 | enum Status { |
| 28 | None = 0, |
| 29 | Loading, |
| 30 | Ready, |
| 31 | Error |
| 32 | }; |
| 33 | Q_ENUM(Status) // LCOV_EXCL_LINE |
| 34 | |
| 35 | QUrl source() const; |
| 36 | Status status() const; |
| 37 | bool isMirrored() const; |
| 38 | |
| 39 | public Q_SLOTS: |
| 40 | void setSource(const QUrl &source); |
| 41 | void setMirrored(bool mirrored); |
| 42 | |
| 43 | Q_SIGNALS: |
| 44 | void sourceChanged(const QUrl &source); |
| 45 | void statusChanged(Status status); |
| 46 | void mirroredChanged(bool mirrored); |
| 47 | |
| 48 | protected: |
| 49 | // TO DO Qt6 -> should be on private class |
| 50 | void setStatus(Status status); |
| 51 | |
| 52 | private: |
| 53 | QTextureImageDataGeneratorPtr dataGenerator() const override; |
| 54 | Q_DECLARE_PRIVATE(QTextureImage) |
| 55 | }; |
| 56 | |
| 57 | } // namespace Qt3DRender |
| 58 | |
| 59 | QT_END_NAMESPACE |
| 60 | |
| 61 | #endif // QT3DRENDER_QTEXTUREIMAGE_H |
| 62 | |