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::sourceSize 相对应。如果requestedSize 是一个有效的大小,返回的图像也应该是这个大小。
注意: 此方法可能会被多个线程调用,因此请确保此方法的实现是可重入的。
© 2025 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.