QQuickRenderTarget#
The QQuickRenderTarget
class provides an opaque container for native graphics resources specifying a render target, and associated metadata. More…
Synopsis#
Functions#
def
devicePixelRatio
()def
isNull
()def
mirrorVertically
()def
__ne__
(rhs)def
__eq__
(rhs)def
setDevicePixelRatio
(ratio)def
setMirrorVertically
(enable)
Static functions#
def
fromOpenGLRenderBuffer
(renderbufferId, pixelSize[, sampleCount=1])def
fromOpenGLTexture
(textureId, pixelSize[, sampleCount=1])def
fromOpenGLTexture
(textureId, format, pixelSize[, sampleCount=1])def
fromPaintDevice
(device)def
fromRhiRenderTarget
(renderTarget)
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#
See also
- class PySide6.QtQuick.QQuickRenderTarget#
PySide6.QtQuick.QQuickRenderTarget(other)
- Parameters:
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.
See also
- static PySide6.QtQuick.QQuickRenderTarget.fromOpenGLRenderBuffer(renderbufferId, pixelSize[, sampleCount=1])#
- Parameters:
renderbufferId – int
pixelSize –
PySide6.QtCore.QSize
sampleCount – int
- Return type:
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.
See also
- static PySide6.QtQuick.QQuickRenderTarget.fromOpenGLTexture(textureId, pixelSize[, sampleCount=1])#
- Parameters:
textureId – int
pixelSize –
PySide6.QtCore.QSize
sampleCount – int
- Return type:
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.
See also
- static PySide6.QtQuick.QQuickRenderTarget.fromOpenGLTexture(textureId, format, pixelSize[, sampleCount=1])
- Parameters:
textureId – int
format – int
pixelSize –
PySide6.QtCore.QSize
sampleCount – int
- Return type:
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.
See also
- static PySide6.QtQuick.QQuickRenderTarget.fromPaintDevice(device)#
- Parameters:
device –
PySide6.QtGui.QPaintDevice
- Return type:
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.
See also
- static PySide6.QtQuick.QQuickRenderTarget.fromRhiRenderTarget(renderTarget)#
- Parameters:
renderTarget –
QRhiRenderTarget
- Return type:
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.
See also
- 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
.
See also
- PySide6.QtQuick.QQuickRenderTarget.__ne__(rhs)#
- Parameters:
- 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:
- 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.
See also
- 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.