| 1 | /****************************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ** Contact: Qt Software Information (qt-info@nokia.com)
|
|---|
| 5 | **
|
|---|
| 6 | ** This file is part of the documentation of the Qt Toolkit.
|
|---|
| 7 | **
|
|---|
| 8 | ** $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 9 | ** Commercial Usage
|
|---|
| 10 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 11 | ** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 12 | ** Software or, alternatively, in accordance with the terms contained in
|
|---|
| 13 | ** a written agreement between you and Nokia.
|
|---|
| 14 | **
|
|---|
| 15 | ** GNU Lesser General Public License Usage
|
|---|
| 16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 17 | ** General Public License version 2.1 as published by the Free Software
|
|---|
| 18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 19 | ** packaging of this file. Please review the following information to
|
|---|
| 20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 22 | **
|
|---|
| 23 | ** In addition, as a special exception, Nokia gives you certain
|
|---|
| 24 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
|---|
| 25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
|---|
| 26 | ** package.
|
|---|
| 27 | **
|
|---|
| 28 | ** GNU General Public License Usage
|
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 32 | ** packaging of this file. Please review the following information to
|
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
|---|
| 35 | **
|
|---|
| 36 | ** If you are unsure which license is appropriate for your use, please
|
|---|
| 37 | ** contact the sales department at qt-sales@nokia.com.
|
|---|
| 38 | ** $QT_END_LICENSE$
|
|---|
| 39 | **
|
|---|
| 40 | ****************************************************************************/
|
|---|
| 41 |
|
|---|
| 42 | /*!
|
|---|
| 43 | \module QtSvg
|
|---|
| 44 | \title QtSvg Module
|
|---|
| 45 | \since 4.1
|
|---|
| 46 | \contentspage Qt's Modules
|
|---|
| 47 | \previouspage QtSql
|
|---|
| 48 | \nextpage QtWebKit
|
|---|
| 49 | \ingroup modules
|
|---|
| 50 |
|
|---|
| 51 | \brief The QtSvg module provides classes for displaying the contents of SVG
|
|---|
| 52 | files.
|
|---|
| 53 |
|
|---|
| 54 | Scalable Vector Graphics (SVG) is a language for describing two-dimensional
|
|---|
| 55 | graphics and graphical applications in XML. SVG 1.1 is a W3C Recommendation
|
|---|
| 56 | and forms the core of the current SVG developments in Qt. SVG 1.2 is the
|
|---|
| 57 | specification currently being developed by the \l{SVG Working Group}, and it
|
|---|
| 58 | is \l{http://www.w3.org/TR/SVG12/}{available in draft form}.
|
|---|
| 59 | The \l{Mobile SVG Profiles} (SVG Basic and SVG Tiny) are aimed at
|
|---|
| 60 | resource-limited devices and are part of the 3GPP platform for third generation
|
|---|
| 61 | mobile phones. You can read more about SVG at \l{About SVG}.
|
|---|
| 62 |
|
|---|
| 63 | \tableofcontents
|
|---|
| 64 |
|
|---|
| 65 | \section1 SVG Support
|
|---|
| 66 | Qt supports the \l{SVG 1.2 Tiny Static Features}{static features} of
|
|---|
| 67 | \l{SVG 1.2 Tiny}. ECMA scripts and DOM manipulation are currently not
|
|---|
| 68 | supported.
|
|---|
| 69 |
|
|---|
| 70 | \section1 Configuring the Build Process
|
|---|
| 71 |
|
|---|
| 72 | Applications that use Qt's SVG classes need to
|
|---|
| 73 | be configured to be built against the QtSvg module.
|
|---|
| 74 | To include the definitions of the module's classes, use the
|
|---|
| 75 | following directive:
|
|---|
| 76 |
|
|---|
| 77 | \snippet doc/src/snippets/code/doc_src_qtsvg.qdoc 0
|
|---|
| 78 |
|
|---|
| 79 | To link against the module, add this line to your \l qmake \c
|
|---|
| 80 | .pro file:
|
|---|
| 81 |
|
|---|
| 82 | \snippet doc/src/snippets/code/doc_src_qtsvg.qdoc 1
|
|---|
| 83 |
|
|---|
| 84 | The QtSvg module is part of the \l{Qt Full Framework Edition} and the
|
|---|
| 85 | \l{Open Source Versions of Qt}.
|
|---|
| 86 |
|
|---|
| 87 | \section1 Rendering SVG files
|
|---|
| 88 |
|
|---|
| 89 | The easiest way to render SVG files is to construct a QSvgWidget and
|
|---|
| 90 | load an SVG file using one of the QSvgWidget::load() functions.
|
|---|
| 91 |
|
|---|
| 92 | QSvgRenderer is the class responsible for rendering SVG files for
|
|---|
| 93 | QSvgWidget, and it can be used directly to provide SVG support for
|
|---|
| 94 | custom widgets.
|
|---|
| 95 | To load an SVG file, construct a QSvgRenderer with a file name or the
|
|---|
| 96 | contents of a file, or call QSvgRenderer::load() on an existing
|
|---|
| 97 | renderer. If the SVG file has been loaded successfully the
|
|---|
| 98 | QSvgRenderer::isValid() will return true.
|
|---|
| 99 |
|
|---|
| 100 | Once you have loaded the SVG file successfully, you can render it
|
|---|
| 101 | with the QSvgRenderer::render() function. Note that this scheme allows
|
|---|
| 102 | you to render SVG files on all paint devices supported by Qt, including
|
|---|
| 103 | QWidget, QGLWidget, and QImage. See the \l{SVG Viewer Example}{SVG Viewer}
|
|---|
| 104 | example for more details.
|
|---|
| 105 |
|
|---|
| 106 | \section1 Additional Information
|
|---|
| 107 |
|
|---|
| 108 | Some code for arc handling in this module is derived from code with
|
|---|
| 109 | the following license:
|
|---|
| 110 |
|
|---|
| 111 | \legalese
|
|---|
| 112 | Copyright 2002 USC/Information Sciences Institute
|
|---|
| 113 |
|
|---|
| 114 | Permission to use, copy, modify, distribute, and sell this software
|
|---|
| 115 | and its documentation for any purpose is hereby granted without
|
|---|
| 116 | fee, provided that the above copyright notice appear in all copies
|
|---|
| 117 | and that both that copyright notice and this permission notice
|
|---|
| 118 | appear in supporting documentation, and that the name of
|
|---|
| 119 | Information Sciences Institute not be used in advertising or
|
|---|
| 120 | publicity pertaining to distribution of the software without
|
|---|
| 121 | specific, written prior permission. Information Sciences Institute
|
|---|
| 122 | makes no representations about the suitability of this software for
|
|---|
| 123 | any purpose. It is provided "as is" without express or implied
|
|---|
| 124 | warranty.
|
|---|
| 125 |
|
|---|
| 126 | INFORMATION SCIENCES INSTITUTE DISCLAIMS ALL WARRANTIES WITH REGARD
|
|---|
| 127 | TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
|
|---|
| 128 | MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL INFORMATION SCIENCES
|
|---|
| 129 | INSTITUTE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
|---|
| 130 | DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
|
|---|
| 131 | OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|---|
| 132 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|---|
| 133 | PERFORMANCE OF THIS SOFTWARE.
|
|---|
| 134 | \endlegalese
|
|---|
| 135 | */
|
|---|