内容表

上一话题

QQuickImageProvider

下一话题

QQuickItem

QQuickImageResponse

QQuickImageResponse class provides an interface for asynchronous image loading in QQuickAsyncImageProvider . 更多

Inheritance diagram of PySide2.QtQuick.QQuickImageResponse

New in version 5.6.

详细描述

The purpose of an image response is to provide a way for image provider jobs to be executed in an asynchronous way.

Responses are deleted via deleteLater once the finished() signal has been emitted. If you are using QRunnable as base for your QQuickImageResponse ensure automatic deletion is disabled.

Image Response Provider Example for a complete implementation.

class QQuickImageResponse

Constructs the image response

PySide2.QtQuick.QQuickImageResponse. cancel ( )

This method is used to communicate that the response is no longer required by the engine.

It may be reimplemented to cancel a request in the provider side, however, it is not mandatory.

A cancelled QQuickImageResponse still needs to emit finished() so that the engine may clean up the QQuickImageResponse .

注意

finished() should not be emitted until the response is complete, regardless of whether or not was called. If it is called prematurely, the engine may destroy the response while it is still active, leading to a crash.

PySide2.QtQuick.QQuickImageResponse. errorString ( )
返回类型

unicode

Returns the error string for the job execution. An empty string means no error.

PySide2.QtQuick.QQuickImageResponse. finished ( )
PySide2.QtQuick.QQuickImageResponse. textureFactory ( )
返回类型

QQuickTextureFactory

Returns the texture factory for the job. You can use textureFactoryForImage if your provider works with QImage . The engine takes ownership of the returned QQuickTextureFactory .

注意

This method will be called only when needed. For example, it may not be called if there is an error or the job is cancelled. Therefore, allocate the QQuickTextureFactory instance only in this method or otherwise ensure its deletion.