Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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} of
31 \l{http://www.w3.org/TR/SVGMobile12}{SVG 1.2 Tiny}. ECMA scripts and DOM
32 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 SVG drawings can be rendered onto any QPaintDevice subclass. This
38 approach gives developers the flexibility to experiment, in order
39 to find the best solution for each application.
40
41 The easiest way to render SVG files is to construct a QSvgWidget and
42 load an SVG file using one of the QSvgWidget::load() functions.
43
44 QSvgRenderer is the class responsible for rendering SVG files for
45 QSvgWidget, and it can be used directly to provide SVG support for
46 custom widgets.
47 To load an SVG file, construct a QSvgRenderer with a file name or the
48 contents of a file, or call QSvgRenderer::load() on an existing
49 renderer. If the SVG file has been loaded successfully the
50 QSvgRenderer::isValid() will return true.
51
52 Once you have loaded the SVG file successfully, you can render it
53 with the QSvgRenderer::render() function. Note that this scheme allows
54 you to render SVG files on all paint devices supported by Qt, including
55 QWidget, QGLWidget, and QImage.
56*/