1// Copyright (C) 2016 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_QPAINTEDTEXTURE_H
5#define QT3DRENDER_QPAINTEDTEXTURE_H
6
7#include <Qt3DRender/qabstracttextureimage.h>
8
9QT_BEGIN_NAMESPACE
10
11class QPainter;
12
13namespace Qt3DRender {
14
15class QPaintedTextureImagePrivate;
16
17class Q_3DRENDERSHARED_EXPORT QPaintedTextureImage : public QAbstractTextureImage
18{
19 Q_OBJECT
20 Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged)
21 Q_PROPERTY(int height READ height WRITE setHeight NOTIFY heightChanged)
22 Q_PROPERTY(QSize size READ size WRITE setSize NOTIFY sizeChanged)
23
24public:
25 explicit QPaintedTextureImage(Qt3DCore::QNode *parent = nullptr);
26 ~QPaintedTextureImage();
27
28 int width() const;
29 int height() const;
30 QSize size() const;
31
32 void update(const QRect &rect = QRect());
33
34public Q_SLOTS:
35 void setWidth(int w);
36 void setHeight(int h);
37 void setSize(QSize size);
38
39Q_SIGNALS:
40 void widthChanged(int w);
41 void heightChanged(int w);
42 void sizeChanged(QSize size);
43
44protected:
45 virtual void paint(QPainter *painter) = 0;
46
47private:
48 Q_DECLARE_PRIVATE(QPaintedTextureImage)
49
50 QTextureImageDataGeneratorPtr dataGenerator() const override;
51};
52
53} // namespace Qt3DRender
54
55QT_END_NAMESPACE
56
57#endif // QT3DRENDER_QPAINTEDTEXTURE_H
58

source code of qt3d/src/render/texture/qpaintedtextureimage.h