A QAbstractTextureImage that can be written through a QPainter . 更多...
头: | #include <QPaintedTextureImage> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender) |
qmake: | QT += 3drender |
继承: | Qt3DRender::QAbstractTextureImage |
int | height () const |
QSize | size () const |
void | update (const QRect & rect = QRect()) |
int | width () const |
void | setHeight (int h ) |
void | setSize (QSize size ) |
void | setWidth (int w ) |
void | heightChanged (int w ) |
void | sizeChanged (QSize size ) |
void | widthChanged (int w ) |
virtual void | paint (QPainter * painter ) = 0 |
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 .
This property holds the height of the texture image. The height must be greater than or equal to 1.
访问函数:
int | height () const |
void | setHeight (int h ) |
通知程序信号:
void | heightChanged (int w ) |
This property holds the size of the texture image.
访问函数:
QSize | size () const |
void | setSize (QSize size ) |
通知程序信号:
void | sizeChanged (QSize size ) |
This property holds the width of the texture image. The width must be greater than or equal to 1.
访问函数:
int | width () const |
void | setWidth (int w ) |
通知程序信号:
void | widthChanged (int w ) |
[pure virtual protected]
void
QPaintedTextureImage::
paint
(
QPainter
*
painter
)
Paints the texture image with the specified QPainter 对象 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()); ...
[slot]
void
QPaintedTextureImage::
setHeight
(
int
h
)
Sets the height ( h ) of the texture image. Triggers an update, if the size changes.
注意: setter 函数对于特性 height .
另请参阅 height ().
[slot]
void
QPaintedTextureImage::
setSize
(
QSize
size
)
Sets the width and height of the texture image. Triggers an update, if the size 改变。
注意: setter 函数对于特性 size .
另请参阅 size ().
[slot]
void
QPaintedTextureImage::
setWidth
(
int
w
)
Sets the width ( w ) of the texture image. Triggers an update, if the size changes.
注意: setter 函数对于特性 width .
另请参阅 width ().
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.
参数 rect is currently unused.