C++ 扩展:图像提供程序示例

如何在 QML 中使用QQuickImageProvider 加载图片。

本示例演示了如何使用QQuickImageProvider 向QML中的Image 项提供图像,以及如何将其打包为QQmlEngineExtensionPlugin ——该文件可在运行时被检测并加载。该插件成为一个可重用的组件,可安装到系统级位置供多个应用程序使用。

由图像提供商生成的两个标有“黄色”和“红色”的色块

示例项目 @ code.qt.io

© 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.