QQuickImageResponse Class

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

头文件: #include <QQuickImageResponse>
qmake: QT += quick
开始支持版本: Qt 5.6
基类: QObject

公有函数

QQuickImageResponse()
virtual ~QQuickImageResponse()
virtual QString errorString() const
virtual QQuickTextureFactory *textureFactory() const = 0
  • 32 个公有函数继承自 QObject

公有槽函数

virtual void cancel()
  • 1 个公有槽函数继承自 QObject

信号

void finished()

其他继承的成员

  • 1 个属性继承自 QObject
  • 1 个公有变量继承自 QObject
  • 10 个静态公有成员继承自 QObject
  • 9 个受保护的函数继承自 QObject
  • 2 个受保护的变量继承自 QObject

详细描述

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

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.

See the Image Response Provider Example for a complete implementation.

参见 QQuickImageProvider.

成员函数

QQuickImageResponse::QQuickImageResponse()

Constructs the image response

[virtual] QQuickImageResponse::~QQuickImageResponse()

Destructs the image response

[virtual slot] void 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().

[virtual] QString QQuickImageResponse::errorString() const

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

[signal] void QQuickImageResponse::finished()

Signals that the job execution has finished (be it successfully, because an error happened or because it was cancelled).

[pure virtual] QQuickTextureFactory *QQuickImageResponse::textureFactory() const

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

Note: 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.