Extended Features

The Qt SVG module supports the static features of SVG 1.2 Tiny .

The module also supports a few extra features which might be useful. The QSvgRenderer parses all features (including the extra feature set) by default. You can instruct the render to ignore these extra features by passing the QtSvg::Tiny12FeaturesOnly flag in QSvgRenderer::setOptions ().

Extended features

Qt supports the following extended elements and related attributes as of Qt 6.7:

Masking

Masking is supported in the form of the <mask> element and the mask attribute.

注意: <clipPath> is not supported.

<mask>

The following attributes of the <mask> element are supported:

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

The mask attribute is supported for all graphical and structural SVG elements.

Symbols, Markers and Patterns

<symbol>

The following attributes of the <symbol> element are supported:

  • x (from SVG 2)
  • y (from SVG 2)
  • width (from SVG 2)
  • height (from SVG 2)
  • preserveAspectRatio
  • viewBox

<marker>

The following attributes of the <marker> element are supported:

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

The attributes

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

are supported for <path> , <line> , <polyline> and <polygon> .

<pattern>

The following attributes are supported:

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

The following attributes are not supported:

  • preserveAspectRatio
  • xlink:href

Filter

Filters in SVG documents apply graphic effects on an element, parts of an element, or the background below the element. Qt supports filter effects applied to the whole element. Qt does not support applying filters on only the element's fill or stroke ( FillPaint and StrokePaint ), or its background ( BackgroundImage and BackgroundAlpha ).

<filter>

The following attributes of the <filter> element are supported:

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

The following attributes of the <filter> element are not supported:

  • filterRes
  • xlink:href

The filter attribute is supported for all graphical and structural SVG elements.

Filter primitives

The filter element contains various filter primitives. Qt supports the most important filter primitives (see below).

All filter primitives share common set of attributes. The following are supported:

  • x
  • y
  • width
  • height
  • in (Supported are SourceGraphic , SourceAlpha , and all references to filters)
  • result

The following attributes are not supported:

  • in (Not supported are BackgroundImage , BackgroundAlpha , FillPaint ,和 StrokePaint )

<feColorMatrix>

The following attributes are supported:

  • type

<feGaussianBlur>

The following attributes are supported:

  • stdDeviation

The following attributes are not supported:

  • edgeMode (the implementation matches none )

<feOffset>

The following attributes are supported:

  • dx
  • dy

<feMerge> and <feMergeNode>

No additional attributes.

<feComposite>

The following attributes are supported:

  • operator
  • k1
  • k2
  • k3
  • k4

<feFlood>

The following attributes are supported:

  • flodd-color
  • flood-opacity