扩展功能

Qt SVG 模块支持SVG 1.2 Tiny静态功能

该模块还支持一些可能有用的额外功能。QSvgRenderer 默认解析所有功能(包括额外功能集)。您可以在QSvgRenderer::setOptions() 中传递QtSvg::Tiny12FeaturesOnly 标志,指示呈现器忽略这些额外功能。

扩展功能

自 Qt 6.7 起,Qt 支持以下扩展元素和相关属性:

屏蔽

<mask> 元素和 mask 属性的形式支持屏蔽。

注意: 不支持 <clipPath>。

<mask> 蒙版

支持<mask> 元素的以下属性:

  • x
  • y
  • width
  • height
  • maskUnits
  • maskContentUnits

所有图形和结构 SVG 元素都支持mask 属性。

符号、标记和图案

<symbol> 符号

支持<symbol> 元素的以下属性:

  • x (来自 SVG 2)
  • y (来自 SVG 2)
  • width (来自 SVG 2)
  • height (来自 SVG 2)
  • preserveAspectRatio
  • viewBox

<marker> 标记

支持<marker> 元素的以下属性:

  • markerUnits
  • refX
  • refY
  • markerWidth
  • markerHeight
  • orient
  • preserveAspectRatio
  • viewBox

属性

  • marker-start
  • marker-mid
  • marker-end

支持<path>,<line>,<polyline><polygon>

<模式

支持以下属性

  • x
  • y
  • width
  • height
  • patternUnits
  • patternContentUnits
  • patternTransform
  • viewBox

不支持以下属性:

  • preserveAspectRatio
  • xlink:href

过滤器

SVG 文档中的过滤器在元素、元素的部分或元素下方的背景上应用图形效果。Qt 支持应用于整个元素的滤镜效果。Qt XML 不支持仅对元素的填充或描边 (FillPaintStrokePaint) 或其背景 (BackgroundImageBackgroundAlpha) 应用滤镜。

<filter> 滤镜

支持<filter> 元素的以下属性:

  • x
  • y
  • width
  • height
  • filterUnits
  • primitiveUnits

不支持<filter> 元素的以下属性:

  • filterRes
  • xlink:href

所有图形和结构 SVG 元素都支持filter 属性。

过滤器基元

filter 元素包含各种过滤原语。Qt 支持最重要的过滤原语(见下文)。

所有过滤原语都有共同的属性集。支持以下内容:

  • x
  • y
  • width
  • height
  • in (支持 、 以及对过滤器的所有引用)。SourceGraphic SourceAlpha
  • result

不支持以下属性:

  • in (不支持 , , , 和 )BackgroundImage BackgroundAlpha FillPaint StrokePaint

<feColorMatrix>(颜色矩阵

支持以下属性:

  • type
  • values

<feGaussianBlur> (高斯模糊

支持以下属性

  • stdDeviation

不支持以下属性:

  • edgeMode (实现与 匹配)none

<feOffset

支持以下属性

  • dx
  • dy

<feMerge>和<feMergeNode>。

不支持其他属性。

<feComposite

支持以下属性:

  • operator
  • k1
  • k2
  • k3
  • k4

<feFlood>(洪水

支持以下属性:

  • flodd-color
  • flood-opacity

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