QPaintedTextureImage Class | Qt 3D 5.12.8

Qt 5.12 | Qt 3D | C++ Classes | QPaintedTextureImage

Qt 5.12.8 Reference Documentation

# QPaintedTextureImage Class

(Qt3DRender::QPaintedTextureImage)

A QAbstractTextureImage that can be written through a QPainter. More...

Header: | #include <QPaintedTextureImage>
qmake: | QT += 3drender
Since: | Qt 5.8
Inherits: | Qt3DRender::QAbstractTextureImage

- List of all members, including inherited members
- Obsolete members

## Properties

- height : int
- size : QSize
- width : int

- 3 properties inherited from Qt3DRender::QAbstractTextureImage
- 3 properties inherited from Qt3DCore::QNode
- 1 property inherited from QObject

## Public Functions

| QPaintedTextureImage(Qt3DCore::QNode *parent = nullptr)
virtual | ~QPaintedTextureImage()
int | height() const
QSize | size() const
void | update(const QRect &rect = QRect())
int | width() const

- 3 public functions inherited from Qt3DRender::QAbstractTextureImage
- 13 public functions inherited from Qt3DCore::QNode
- 31 public functions inherited from QObject

## Public Slots

void | setHeight(int h)
void | setSize(QSize size)
void | setWidth(int w)

- 3 public slots inherited from Qt3DRender::QAbstractTextureImage
- 3 public slots inherited from Qt3DCore::QNode
- 1 public slot inherited from QObject

## Signals

void | heightChanged(int w)
void | sizeChanged(QSize size)
void | widthChanged(int w)

- 3 signals inherited from Qt3DRender::QAbstractTextureImage
- 4 signals inherited from Qt3DCore::QNode
- 2 signals inherited from QObject

## Static Public Members

const QMetaObject | staticMetaObject

- 9 static public members inherited from QObject

## Protected Functions

virtual void | paint(QPainter *painter) = 0

- 2 protected functions inherited from Qt3DRender::QAbstractTextureImage
- 2 protected functions inherited from Qt3DCore::QNode
- 9 protected functions inherited from QObject

## Detailed Description

A QAbstractTextureImage that can be written through a QPainter.

A QPaintedTextureImage provides a way to specify a texture image (and thus an OpenGL texture) through a QPainter. The width and height of the texture image can be specified through the width and height or size properties.

A QPaintedTextureImage must be subclassed and the virtual paint() function implemented. Each time update() is called on the QPaintedTextureImage, the paint() function is invoked and the resulting image is uploaded.

The QPaintedTextureImage must be attached to some QAbstractTexture.

## Property Documentation

### height : int

This property holds the height of the texture image. The height must be greater than or equal to 1.

Access functions:

int | height() const
void | setHeight(int h)

Notifier signal:

void | heightChanged(int w)

### size : QSize

This property holds the size of the texture image.

Access functions:

QSize | size() const
void | setSize(QSize size)

Notifier signal:

void | sizeChanged(QSize size)

See also height and width.

### width : int

This property holds the width of the texture image. The width must be greater than or equal to 1.

Access functions:

int | width() const
void | setWidth(int w)

Notifier signal:

void | widthChanged(int w)

## Member Function Documentation

### QPaintedTextureImage::QPaintedTextureImage(Qt3DCore::QNode *parent = nullptr)

Default constructs an instance of QPaintedTextureImage.

### `[virtual]` QPaintedTextureImage::~QPaintedTextureImage()

Destroys the instance of QPaintedTextureImage. The destructor is virtual.

### `[pure virtual protected]` void QPaintedTextureImage::paint(QPainter *painter)

Paints the texture image with the specified QPainter object painter.

### `[slot]` void QPaintedTextureImage::setHeight(int h)

Sets the height (h) of the texture image. Triggers an update, if the size changes.

Note: Setter function for property height.

See also height().

### `[slot]` void QPaintedTextureImage::setSize(QSize size)

Sets the width and height of the texture image. Triggers an update, if the size changes.

Note: Setter function for property size.

See also size().

### `[slot]` void QPaintedTextureImage::setWidth(int w)

Sets the width (w) of the texture image. Triggers an update, if the size changes.

Note: Setter function for property width.

See also width().

### void QPaintedTextureImage::update(const QRect &rect = QRect())

Schedules the painted texture's paint() function to be called, which in turn uploads the new image to the GPU. Parameter rect is currently unused.