QPaintedTextureImage露

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

Inheritance diagram of PySide2.Qt3DRender.Qt3DRender.QPaintedTextureImage

Synopsis露

Functions露

Virtual functions露

Slots露

Signals露

Detailed Description露

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 .

class PySide2.Qt3DRender.Qt3DRender.QPaintedTextureImage([parent=None])露
Parameters:

parent 鈥� PySide2.Qt3DCore.Qt3DCore.QNode

PySide2.Qt3DRender.Qt3DRender.QPaintedTextureImage.height()露
Return type:

int

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

PySide2.Qt3DRender.Qt3DRender.QPaintedTextureImage.heightChanged(w)露
Parameters:

w 鈥� int

PySide2.Qt3DRender.Qt3DRender.QPaintedTextureImage.paint(painter)露
Parameters:

painter 鈥� PySide2.QtGui.QPainter

Paints the texture image with the specified QPainter object painter .

QPainter considers the top-left corner of an image as its origin, while OpenGL considers the bottom-left corner of a texture as its origin. An easy way to account for this difference is to set a custom viewport on the painter before doing any other painting:

painter->setViewport(0, height(), width(), -height());
...
PySide2.Qt3DRender.Qt3DRender.QPaintedTextureImage.setHeight(h)露
Parameters:

h 鈥� int

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

PySide2.Qt3DRender.Qt3DRender.QPaintedTextureImage.setSize(size)露
Parameters:

size 鈥� PySide2.QtCore.QSize

This property holds the size of the texture image.

See also

height width

PySide2.Qt3DRender.Qt3DRender.QPaintedTextureImage.setWidth(w)露
Parameters:

w 鈥� int

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

PySide2.Qt3DRender.Qt3DRender.QPaintedTextureImage.size()露
Return type:

PySide2.QtCore.QSize

This property holds the size of the texture image.

See also

height width

PySide2.Qt3DRender.Qt3DRender.QPaintedTextureImage.sizeChanged(size)露
Parameters:

size 鈥� PySide2.QtCore.QSize

PySide2.Qt3DRender.Qt3DRender.QPaintedTextureImage.update([rect=QRect()])露
Parameters:

rect 鈥� PySide2.QtCore.QRect

Immediately triggers the painted texture鈥檚 paint() function, which in turn uploads the new image to the GPU. If you are making multiple changes to a painted texture, consider waiting until all changes are complete before calling update, in order to minimize the number of repaints required.

Parameter rect is currently unused.

PySide2.Qt3DRender.Qt3DRender.QPaintedTextureImage.width()露
Return type:

int

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

PySide2.Qt3DRender.Qt3DRender.QPaintedTextureImage.widthChanged(w)露
Parameters:

w 鈥� int