Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
svgrendering.qdoc
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5 \page svgrendering.html
6 \title Rendering SVG Files
7 \brief Rendering SVG files with the Qt SVG module
8
9 Qt SVG provides classes for rendering SVG files. To include the definitions
10 of the module's classes, use the following directive:
11
12 \snippet doc_src_qtsvg.cpp 0
13
14 To link against the module, add this line to your \l qmake \c
15 .pro file:
16
17 \snippet doc_src_qtsvg.pro 1
18
19 \section1 Rendering SVG Files
20
21 Scalable Vector Graphics (SVG) is a language for describing two-dimensional
22 graphics and graphical applications in XML. SVG 1.1 is a W3C Recommendation
23 and forms the core of the current SVG developments in Qt. SVG 1.2 is the
24 specification currently being developed by the \l{SVG Working Group}, and it
25 is \l{http://www.w3.org/TR/SVG12/}{available in draft form}. The \l{Mobile
26 SVG Profiles} (SVG Basic and SVG Tiny) are aimed at resource-limited devices
27 and are part of the 3GPP platform for third generation mobile phones. You
28 can read more about SVG at \l{About SVG}.
29
30 Qt supports the \l{SVG 1.2 Tiny Static Features}{static features} as well as
31 color and transform animations of \l{http://www.w3.org/TR/SVGMobile12}{SVG 1.2 Tiny}.
32 ECMA scripts and DOM manipulation are currently not supported.
33
34 Since Qt 6.7, some \l{Extended Features}{additional features} of the
35 \l{https://www.w3.org/TR/SVG11/}{SVG 1.1} standard are supported.
36
37 Since Qt 6.9, CSS animations for fill, stroke and transform were added to
38 match the currently supported SMIL animations by the module.
39
40 SVG drawings can be rendered onto any QPaintDevice subclass. This
41 approach gives developers the flexibility to experiment, in order
42 to find the best solution for each application.
43
44 The easiest way to render SVG files is to construct a QSvgWidget and
45 load an SVG file using one of the QSvgWidget::load() functions.
46
47 QSvgRenderer is the class responsible for rendering SVG files for
48 QSvgWidget, and it can be used directly to provide SVG support for
49 custom widgets.
50 To load an SVG file, construct a QSvgRenderer with a file name or the
51 contents of a file, or call QSvgRenderer::load() on an existing
52 renderer. If the SVG file has been loaded successfully the
53 QSvgRenderer::isValid() will return true.
54
55 Once you have loaded the SVG file successfully, you can render it
56 with the QSvgRenderer::render() function. Note that this scheme allows
57 you to render SVG files on all paint devices supported by Qt, including
58 QWidget, QGLWidget, and QImage.
59*/