QQuickFramebufferObject#

The QQuickFramebufferObject class is a convenience class for integrating OpenGL rendering using a framebuffer object (FBO) with Qt Quick. More

Inheritance diagram of PySide6.QtQuick.QQuickFramebufferObject

Synopsis#

Properties#

Functions#

Virtual functions#

Signals#

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#

Warning

This class is only functional when Qt Quick is rendering via OpenGL. It is not compatible with other graphics APIs, such as Vulkan or Metal. It should be treated as a legacy class that is only present in order to enable Qt 5 applications to function without source compatibility breaks as long as they tie themselves to OpenGL.

On most platforms, the rendering will occur on a dedicated thread . For this reason, the QQuickFramebufferObject class enforces a strict separation between the item implementation and the FBO rendering. All item logic, such as properties and UI-related helper functions needed by QML should be located in a QQuickFramebufferObject class subclass. Everything that relates to rendering must be located in the Renderer class.

To avoid race conditions and read/write issues from two threads it is important that the renderer and the item never read or write shared variables. Communication between the item and the renderer should primarily happen via the synchronize() function. This function will be called on the render thread while the GUI thread is blocked.

Using queued connections or events for communication between item and renderer is also possible.

Both the Renderer and the FBO are memory managed internally.

To render into the FBO, the user should subclass the Renderer class and reimplement its render() function. The Renderer subclass is returned from createRenderer() .

The size of the FBO will by default adapt to the size of the item. If a fixed size is preferred, set textureFollowsItemSize to false and return a texture of your choosing from createFramebufferObject() .

Starting Qt 5.4, the QQuickFramebufferObject class is a texture provider and can be used directly in ShaderEffects and other classes that consume texture providers.

class PySide6.QtQuick.QQuickFramebufferObject([parent=None])#
Parameters:

parentPySide6.QtQuick.QQuickItem

Constructs a new QQuickFramebufferObject with parent parent.

Note

Properties can be used directly when from __feature__ import true_property is used or via accessor functions otherwise.

property PᅟySide6.QtQuick.QQuickFramebufferObject.mirrorVertically: bool#

This property controls if the size of the FBO’s contents should be mirrored vertically when drawing. This allows easy integration of third-party rendering code that does not follow the standard expectations.

The default value is false.

Access functions:
property PᅟySide6.QtQuick.QQuickFramebufferObject.textureFollowsItemSize: bool#

This property controls if the size of the FBO’s texture should follow the dimensions of the QQuickFramebufferObject item. When this property is false, the FBO will be created once the first time it is displayed. If it is set to true, the FBO will be recreated every time the dimensions of the item change.

The default value is true.

Access functions:
abstract PySide6.QtQuick.QQuickFramebufferObject.createRenderer()#
Return type:

PySide6.QtQuick.QQuickFramebufferObject.Renderer

Reimplement this function to create a renderer used to render into the FBO.

This function will be called on the rendering thread while the GUI thread is blocked.

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

bool

Getter of property mirrorVertically .

PySide6.QtQuick.QQuickFramebufferObject.mirrorVerticallyChanged(arg__1)#
Parameters:

arg__1 – bool

Notification signal of property mirrorVertically .

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

enable – bool

Setter of property mirrorVertically .

PySide6.QtQuick.QQuickFramebufferObject.setTextureFollowsItemSize(follows)#
Parameters:

follows – bool

Setter of property textureFollowsItemSize .

PySide6.QtQuick.QQuickFramebufferObject.textureFollowsItemSize()#
Return type:

bool

Getter of property textureFollowsItemSize .

PySide6.QtQuick.QQuickFramebufferObject.textureFollowsItemSizeChanged(arg__1)#
Parameters:

arg__1 – bool

Notification signal of property textureFollowsItemSize .