Qt 6.x
The Qt SDK
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 manipulation are currently not
32 supported.
33
34 SVG drawings can be rendered onto any QPaintDevice subclass. This
35 approach gives developers the flexibility to experiment, in order
36 to find the best solution for each application.
37
38 The easiest way to render SVG files is to construct a QSvgWidget and
39 load an SVG file using one of the QSvgWidget::load() functions.
40
41 QSvgRenderer is the class responsible for rendering SVG files for
42 QSvgWidget, and it can be used directly to provide SVG support for
43 custom widgets.
44 To load an SVG file, construct a QSvgRenderer with a file name or the
45 contents of a file, or call QSvgRenderer::load() on an existing
46 renderer. If the SVG file has been loaded successfully the
47 QSvgRenderer::isValid() will return true.
48
49 Once you have loaded the SVG file successfully, you can render it
50 with the QSvgRenderer::render() function. Note that this scheme allows
51 you to render SVG files on all paint devices supported by Qt, including
52 QWidget, QGLWidget, and QImage.
53*/