- class QPaintedTextureImage¶
A
QAbstractTextureImage
that can be written through a QPainter. More…Synopsis¶
Properties¶
Methods¶
def
__init__()
def
height()
def
size()
def
update()
def
width()
Virtual methods¶
def
paint()
Slots¶
def
setHeight()
def
setSize()
def
setWidth()
Signals¶
def
heightChanged()
def
sizeChanged()
def
widthChanged()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
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 virtualpaint()
function implemented. Each timeupdate()
is called on theQPaintedTextureImage
, thepaint()
function is invoked and the resulting image is uploaded.The
QPaintedTextureImage
must be attached to someQAbstractTexture
.Note
Properties can be used directly when
from __feature__ import true_property
is used or via accessor functions otherwise.- property heightᅟ: int¶
This property holds the height of the texture image. The height must be greater than or equal to 1.
- Access functions:
Signal
heightChanged()
This property holds the size of the texture image.
See also
height
width
- Access functions:
Signal
sizeChanged()
- property widthᅟ: int¶
This property holds the width of the texture image. The width must be greater than or equal to 1.
- Access functions:
Signal
widthChanged()
- __init__([parent=None])¶
- Parameters:
parent –
QNode
- height()¶
- Return type:
int
See also
setHeight()
Getter of property
heightᅟ
.- heightChanged(w)¶
- Parameters:
w – int
Notification signal of property
heightᅟ
.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()); ...
- setHeight(h)¶
- Parameters:
h – int
Sets the height (
h
) of the texture image. Triggers an update, if the size changes.See also
height()
Setter of property
heightᅟ
.Sets the width and height of the texture image. Triggers an update, if the
size
changes.See also
size()
Setter of property
sizeᅟ
.- setWidth(w)¶
- Parameters:
w – int
Sets the width (
w
) of the texture image. Triggers an update, if the size changes.See also
width()
Setter of property
widthᅟ
.Getter of property
sizeᅟ
.Notification signal of property
sizeᅟ
.Immediately triggers the painted texture’s
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.- width()¶
- Return type:
int
See also
setWidth()
Getter of property
widthᅟ
.- widthChanged(w)¶
- Parameters:
w – int
Notification signal of property
widthᅟ
.