QQuickRenderTarget#

The QQuickRenderTarget class provides an opaque container for native graphics resources specifying a render target, and associated metadata. More

Synopsis#

Functions#

Static functions#

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#

class PySide6.QtQuick.QQuickRenderTarget#

PySide6.QtQuick.QQuickRenderTarget(other)

Parameters:

otherPySide6.QtQuick.QQuickRenderTarget

Constructs a default QQuickRenderTarget that does not reference any native objects.

PySide6.QtQuick.QQuickRenderTarget.devicePixelRatio()#
Return type:

float

Returns the device pixel ratio for the render target. This is the ratio between device pixels and device independent pixels.

The default device pixel ratio is 1.0.

static PySide6.QtQuick.QQuickRenderTarget.fromOpenGLRenderBuffer(renderbufferId, pixelSize[, sampleCount=1])#
Parameters:
Return type:

PySide6.QtQuick.QQuickRenderTarget

Returns a new QQuickRenderTarget referencing an OpenGL renderbuffer object specified by renderbufferId.

The renderbuffer will be used as the color attachment for the internal framebuffer object. This function is provided to allow targeting renderbuffers that are created by the application with some external buffer underneath, such as an EGLImageKHR. Once the application has called glEGLImageTargetRenderbufferStorageOES , the renderbuffer can be passed to this function.

pixelSize specifies the size of the image, in pixels.

sampleCount specific the number of samples. 0 or 1 means no multisampling, while a value like 4 or 8 states that the native object is a multisample renderbuffer.

Note

the resulting QQuickRenderTarget does not own any native resources, it merely contains references and the associated metadata of the size and sample count. It is the caller’s responsibility to ensure that the native resource exists as long as necessary.

static PySide6.QtQuick.QQuickRenderTarget.fromOpenGLTexture(textureId, pixelSize[, sampleCount=1])#
Parameters:
Return type:

PySide6.QtQuick.QQuickRenderTarget

This is an overloaded function.

Returns a new QQuickRenderTarget referencing an OpenGL texture object specified by textureId. The texture is assumed to have a format of GL_RGBA (GL_RGBA8).

pixelSize specifies the size of the image, in pixels. Currently only 2D textures are supported.

sampleCount specific the number of samples. 0 or 1 means no multisampling, while a value like 4 or 8 states that the native object is a multisample texture.

The texture is used as the first color attachment of the render target used by the Qt Quick scenegraph. A depth-stencil buffer, if applicable, is created and used automatically.

The OpenGL object name textureId must be a valid name in the rendering context used by the Qt Quick scenegraph.

Note

the resulting QQuickRenderTarget does not own any native resources, it merely contains references and the associated metadata of the size and sample count. It is the caller’s responsibility to ensure that the native resource exists as long as necessary.

static PySide6.QtQuick.QQuickRenderTarget.fromOpenGLTexture(textureId, format, pixelSize[, sampleCount=1])
Parameters:
Return type:

PySide6.QtQuick.QQuickRenderTarget

Returns a new QQuickRenderTarget referencing an OpenGL texture object specified by textureId.

format specifies the native internal format of the texture. Only texture formats that are supported by Qt’s rendering infrastructure should be used.

pixelSize specifies the size of the image, in pixels. Currently only 2D textures are supported.

sampleCount specific the number of samples. 0 or 1 means no multisampling, while a value like 4 or 8 states that the native object is a multisample texture.

The texture is used as the first color attachment of the render target used by the Qt Quick scenegraph. A depth-stencil buffer, if applicable, is created and used automatically.

The OpenGL object name textureId must be a valid name in the rendering context used by the Qt Quick scenegraph.

Note

the resulting QQuickRenderTarget does not own any native resources, it merely contains references and the associated metadata of the size and sample count. It is the caller’s responsibility to ensure that the native resource exists as long as necessary.

static PySide6.QtQuick.QQuickRenderTarget.fromPaintDevice(device)#
Parameters:

devicePySide6.QtGui.QPaintDevice

Return type:

PySide6.QtQuick.QQuickRenderTarget

Returns a new QQuickRenderTarget referencing a paint device object specified by device.

This option of redirecting rendering to a QPaintDevice is available only when running with the software backend of Qt Quick.

Note

The QQuickRenderTarget does not take ownship of device, it is the caller’s responsibility to ensure the object exists as long as necessary.

static PySide6.QtQuick.QQuickRenderTarget.fromRhiRenderTarget(renderTarget)#
Parameters:

renderTargetQRhiRenderTarget

Return type:

PySide6.QtQuick.QQuickRenderTarget

Returns a new QQuickRenderTarget referencing an existing renderTarget.

renderTarget will in most cases be a QRhiTextureRenderTarget, which allows directing the Qt Quick scene’s rendering into a QRhiTexture.

Note

the resulting QQuickRenderTarget does not own renderTarget and any underlying native resources, it merely contains references and the associated metadata of the size and sample count. It is the caller’s responsibility to ensure that the referenced resources exists as long as necessary.

PySide6.QtQuick.QQuickRenderTarget.isNull()#
Return type:

bool

Returns true if this QQuickRenderTarget is default constructed, referencing no native objects.

PySide6.QtQuick.QQuickRenderTarget.mirrorVertically()#
Return type:

bool

Returns Returns whether the render target is mirrored vertically.

The default value is false.

PySide6.QtQuick.QQuickRenderTarget.__ne__(rhs)#
Parameters:

rhsPySide6.QtQuick.QQuickRenderTarget

Return type:

bool

Returns true if a and b refer to a different set of native objects, or the associated data (size, sample count) does not match.

PySide6.QtQuick.QQuickRenderTarget.__eq__(rhs)#
Parameters:

rhsPySide6.QtQuick.QQuickRenderTarget

Return type:

bool

Returns true if a and b refer to the same set of native objects and have matching associated data (size, sample count).

PySide6.QtQuick.QQuickRenderTarget.setDevicePixelRatio(ratio)#
Parameters:

ratio – float

Sets the device pixel ratio for this render target to ratio. This is the ratio between device pixels and device independent pixels.

Note that the specified device pixel ratio value will be ignored if renderWindow() is re-implemented to return a valid QWindow.

PySide6.QtQuick.QQuickRenderTarget.setMirrorVertically(enable)#
Parameters:

enable – bool

Sets the size of the render target contents should be mirrored vertically to enable when drawing. This allows easy integration of third-party rendering code that does not follow the standard expectations.

Note

This function should not be used when using the software backend.