Qt SVG
可缩放矢量图形(SVG)是一种基于 XML 的语言,用于描述二维矢量图形。Qt 提供了用于在小部件和其他绘图设备上渲染和显示 SVG 图形的类。
使用模块
要使用 Qt 模块的 C++ API,需要将项目链接到该模块库,既可以直接链接,也可以通过其他依赖项间接链接。包括CMake和qmake 在内的多种构建工具都为此提供了专门的支持。
使用 CMake 构建
使用find_package() 命令在Qt6 软件包中定位所需的模块组件:
find_package(Qt6 REQUIRED COMPONENTS Svg)
target_link_libraries(mytarget PRIVATE Qt6::Svg)更多详细信息,请参阅“使用 CMake 构建”概述。
使用 qmake 构建
要配置模块以便使用 qmake 进行构建,请在项目的 .pro 文件中将该模块作为QT 变量的值添加:
QT += svg文章与指南
- 《渲染 SVG 文件》包含有关如何渲染 SVG 文件的信息
参考资料
Qt SVG 附带以下示例:
模块演变
“Qt SVG ”部分列出了针对 Qt 6 系列所做的模块 API 和功能方面的重大变更。
许可与归属
Qt SVG 该模块由The Qt Company 提供商业许可。此外,它还遵循GNU 较少通用公共许可证第 3 版或GNU 通用公共许可证第 2 版。更多详细信息请参阅Qt 许可。
此外,Qt SVG 包含以下宽松许可下的第三方代码:
© 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.