QQuickTextureFactory Class
The QQuickTextureFactory class provides an interface for loading custom textures from QML. 更多...
头文件: | #include <QQuickTextureFactory> |
qmake: | QT += quick |
开始支持版本: | Qt 5.0 |
基类: | QObject |
公有函数
QQuickTextureFactory() | |
virtual | ~QQuickTextureFactory() |
virtual QSGTexture * | createTexture(QQuickWindow *window) const = 0 |
virtual QImage | image() const |
virtual int | textureByteCount() const = 0 |
virtual QSize | textureSize() const = 0 |
- 32 个公有函数继承自 QObject
静态公有成员
QQuickTextureFactory * | textureFactoryForImage(const QImage &image) |
- 10 个静态公有成员继承自 QObject
其他继承的成员
- 1 个属性继承自 QObject
- 1 个公有槽函数继承自 QObject
- 2 个信号继承自 QObject
- 1 个公有变量继承自 QObject
- 9 个受保护的函数继承自 QObject
- 2 个受保护的变量继承自 QObject
详细描述
The QQuickTextureFactory class provides an interface for loading custom textures from QML.
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.
成员函数
QQuickTextureFactory::QQuickTextureFactory()
Constructs a texture factory. Since QQuickTextureFactory is abstract, it cannot be instantiated directly.
[virtual]
QQuickTextureFactory::~QQuickTextureFactory()
Destroys the texture factory.
[pure virtual]
QSGTexture *QQuickTextureFactory::createTexture(QQuickWindow *window) const
This function is called on the scene graph rendering thread to create a QSGTexture instance from the factory. window provides 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.
[virtual]
QImage QQuickTextureFactory::image() const
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.
[pure virtual]
int QQuickTextureFactory::textureByteCount() const
Returns the number of bytes of memory the texture consumes.
[static]
QQuickTextureFactory *QQuickTextureFactory::textureFactoryForImage(const QImage &image)
Returns a QQuickTextureFactory holding the given image.
This is typically used as a helper in QQuickImageResponse::textureFactory.
This function was introduced in Qt 5.6.
[pure virtual]
QSize QQuickTextureFactory::textureSize() const
Returns the size of the texture. This function will be called from arbitrary threads and should not rely on an OpenGL context bound.