Qt 画布绘画器
Qt Canvas Painter 模块提供了用于硬件加速命令式 2D 绘画的类。该绘画 API 可用于Qt Quick 和Qt Widgets ,也可直接用于QRhi 。API 的设计总体上遵循 HTML 画布 2D 上下文,但有所删减和增加。
与QPainter 相比,Qt Canvas Painter 更为紧凑,抽象化程度更低,目的是在QRhi 上发挥最佳性能。Qt Canvas Painter 专为 GPU 渲染而设计,不像QPainter 那样有 CPU 后端。
注意: 6.11 中的 Qt Canvas Painter 处于技术预览阶段,其 API 不在Qt 的兼容性承诺范围内。
使用模块
C++ API
使用 Qt 模块的 C++ API 需要直接或通过其他依赖关系与模块库链接。包括CMake和qmake 在内的几款构建工具都为此提供了专门支持。
使用 CMake 构建
使用find_package() 命令在Qt6 软件包中找到所需的模块组件:
find_package(Qt6 REQUIRED COMPONENTS CanvasPainter)
target_link_libraries(mytarget PRIVATE Qt6::CanvasPainter)更多详情,请参阅使用 CMake 构建概述。
类参考
示例
许可和归属
Qt Canvas Painter 运行时库可根据商业许可从The Qt Company 购买。此外,它还受GNU 通用公共许可证第 3 版的保护。
有关详细信息,请参阅Qt Licensing。
此外,6.11.0 版中的 Qt Canvas Painter 可能包含以下许可下的第三方模块:
zlib 许可证 |
© 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.