Skip to content

ImageProvider

ModuleQuick
Include
#include <QCoroImageProvider>
CMake
target_link_libraries(myapp QCoro::Quick)
QMake
QT += QCoroQuick

Coroutines based implementation of QQuickImaqeProvider.

To use QCoro::ImageProvider, you need to create a subclass of it, and implement the asyncRequestImage function, as shown in the example below:

#include <QCoro/QCoroImageProvider>

class IconImageProvider : public QCoro::ImageProvider
{
public:
    QCoro::Task<QImage> asyncRequestImage(const QString &id, const QSize &) override;
};

The subclass can be registered with a QQmlEngine like any QQuickImageProvider subclass.