QQuickImageResponse Class

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

Header: #include <QQuickImageResponse>
qmake: QT += quick
Since: Qt 5.6
Inherits: QObject

Public Functions

QQuickImageResponse()
virtual ~QQuickImageResponse()
virtual QString errorString() const
virtual QQuickTextureFactory *textureFactory() const = 0
  • 32 public functions inherited from QObject

Public Slots

virtual void cancel()
  • 1 public slot inherited from QObject

Signals

void finished()

Additional Inherited Members

  • 1 property inherited from QObject
  • 11 static public members inherited from QObject
  • 9 protected functions inherited from QObject

Detailed Description

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.

See also QQuickImageProvider.

Member Function Documentation

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.

© 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.