PySide6.QtQuick.QQuickTextureFactory¶
- class QQuickTextureFactory¶
- The - QQuickTextureFactoryclass provides an interface for loading custom textures from QML. More…- Synopsis¶- Methods¶- def - __init__()
 - Virtual methods¶- def - createTexture()
- def - image()
- def - textureSize()
 - 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¶- The purpose of the texture factory is to provide a placeholder for a image data that can be converted into an OpenGL texture. - Creating a texture directly is not possible as there is rarely an OpenGL context available in the thread that is responsible for loading the image data. - __init__()¶
 - Constructs a texture factory. Since - QQuickTextureFactoryis abstract, it cannot be instantiated directly.- abstract createTexture(window)¶
- Parameters:
- window – - QQuickWindow
- Return type:
 
 - This function is called on the scene graph rendering thread to create a - QSGTextureinstance from the factory.- windowprovides the context which this texture is created in.- QML will internally cache the returned texture as needed. Each call to this function should return a unique instance. - The OpenGL context used for rendering is bound when this function is called. - Returns an image version of this texture. - The lifespan of the returned image is unknown, so the implementation should return a self contained QImage, not make use of the QImage(uchar *, …) constructor. - This function is not commonly used and is expected to be slow. - abstract textureByteCount()¶
- Return type:
- int 
 
 - Returns the number of bytes of memory the texture consumes. - Returns a - QQuickTextureFactoryholding the given- image.- This is typically used as a helper in - textureFactory.- Returns the size of the texture. This function will be called from arbitrary threads and should not rely on an OpenGL context bound.