QQuickAsyncImageProvider Class
QQuickAsyncImageProvider 类提供了一个用于异步控制 QML 图像请求的接口。更多内容...
| 头文件: | #include <QQuickAsyncImageProvider> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Quick) target_link_libraries(mytarget PRIVATE Qt6::Quick) |
| qmake: | QT += quick |
| 继承自: | QQuickImageProvider |
公共函数
| virtual QQuickImageResponse * | requestImageResponse(const QString &id, const QSize &requestedSize) = 0 |
详细说明
请参阅“图像响应提供程序示例”以获取完整的实现。
另请参阅 QQuickImageProvider 。
成员函数文档
[pure virtual] QQuickImageResponse *QQuickAsyncImageProvider::requestImageResponse(const QString &id, const QSize &requestedSize)
实现此方法,以返回将通过id 提供纹理的任务。
id 是所请求的图像源,其中已移除了“image:”方案和提供商标识符。例如,如果图像source 的原始地址为“image://myprovider/icons/home”,则给定的id 即为“icons/home”。
requestedSize 对应于 Image 项请求的Image::sourceSize 。如果requestedSize 是有效尺寸,则返回的图像应为此尺寸。
注意:此 方法可能被多个线程调用,因此请确保此方法的实现是可重入的。
© 2026 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.