上一话题

SVG 生成器范例

下一话题

第 1 章:编写单元测试

SVG 查看器范例

SVG 查看器范例展示如何向应用程序添加 SVG 查看支持。

../_images/svgviewer-example.png

SVG (可伸缩向量图形) 是用于描述 2D 向量图形,基于 XML 的语言。Qt 提供用于在 Widget 及其它描绘设备渲染和显示 SVG 绘制的类。此范例允许用户加载 SVG 文件并查看它们在 QGraphicsView 使用 QGraphicsSvgItem 。基于选定的渲染器 QGraphicsView 使用 QWidget or QGLWidget as its viewport. A third render mode is also provided, where the QGraphicsView 间接绘制透过 QImage 。这允许测试本机、光栅及 OpenGL 描绘引擎的绘制精度和性能。

See the Qt SVG module documentation for more information about SVG and Qt’s SVG classes.

范例工程 @ code.qt.io