演示效果
1. 继承QQuickImageProvider类自定义图像提供者
class ImageProviderPixmap : public QQuickImageProvider
2. 重写基类requestPixmap函数请求图像
QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
3. //添加图像提供者到QML引擎
QQmlApplicationEngine engine;
engine.addImageProvider(QLatin1String("imageProviderPixmap"), new ImageProviderPixmap(QQmlImageProviderBase::Pixmap));
4. QML前端使用自定义图像提供者
Image {
anchors.centerIn