Sophie

Sophie

distrib > Mandriva > current > i586 > media > main-updates > by-pkgid > 8e6051afcdb111a0317a58fb64c2abf5 > files > 5069

qt4-doc-4.6.3-0.2mdv2010.2.i586.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- qsvgrenderer.cpp -->
<head>
  <title>Qt 4.6: QSvgRenderer Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<a name="//apple_ref/cpp/cl//QSvgRenderer"></a>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">All&nbsp;Functions</font></a>&nbsp;&middot; <a href="overviews.html"><font color="#004faf">Overviews</font></a></td></tr></table><h1 class="title">QSvgRenderer Class Reference<br /><span class="small-subtitle">[<a href="qtsvg.html">QtSvg</a> module]</span>
</h1>
<p>The QSvgRenderer class is used to draw the contents of SVG files onto paint devices. <a href="#details">More...</a></p>
<pre> #include &lt;QSvgRenderer&gt;</pre><p><b>This class is not part of the Qt GUI Framework Edition.</b></p>
<p>Inherits <a href="qobject.html">QObject</a>.</p>
<p><b>Note:</b> All functions in this class are <a href="threads-reentrancy.html#reentrant">reentrant</a>.</p>
<p>This class was introduced in Qt 4.1.</p>
<ul>
<li><a href="qsvgrenderer-members.html">List of all members, including inherited members</a></li>
</ul>
<hr />
<a name="properties"></a>
<h2>Properties</h2>
<ul>
<li><div class="fn"><b><a href="qsvgrenderer.html#framesPerSecond-prop">framesPerSecond</a></b> : int</div></li>
<li><div class="fn"><b><a href="qsvgrenderer.html#viewBox-prop">viewBox</a></b> : QRectF</div></li>
</ul>
<ul>
<li><div bar="2" class="fn"></div>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
</ul>
<hr />
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qsvgrenderer.html#QSvgRenderer">QSvgRenderer</a></b> ( QObject * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qsvgrenderer.html#QSvgRenderer-2">QSvgRenderer</a></b> ( const QString &amp; <i>filename</i>, QObject * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qsvgrenderer.html#QSvgRenderer-3">QSvgRenderer</a></b> ( const QByteArray &amp; <i>contents</i>, QObject * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qsvgrenderer.html#QSvgRenderer-4">QSvgRenderer</a></b> ( QXmlStreamReader * <i>contents</i>, QObject * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qsvgrenderer.html#dtor.QSvgRenderer">~QSvgRenderer</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qsvgrenderer.html#animated">animated</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QRectF </td><td class="memItemRight" valign="bottom"><b><a href="qsvgrenderer.html#boundsOnElement">boundsOnElement</a></b> ( const QString &amp; <i>id</i> ) const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QSize </td><td class="memItemRight" valign="bottom"><b><a href="qsvgrenderer.html#defaultSize">defaultSize</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qsvgrenderer.html#elementExists">elementExists</a></b> ( const QString &amp; <i>id</i> ) const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qsvgrenderer.html#framesPerSecond-prop">framesPerSecond</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qsvgrenderer.html#isValid">isValid</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QMatrix </td><td class="memItemRight" valign="bottom"><b><a href="qsvgrenderer.html#matrixForElement">matrixForElement</a></b> ( const QString &amp; <i>id</i> ) const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsvgrenderer.html#framesPerSecond-prop">setFramesPerSecond</a></b> ( int <i>num</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsvgrenderer.html#viewBox-prop">setViewBox</a></b> ( const QRect &amp; <i>viewbox</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsvgrenderer.html#viewBox-prop">setViewBox</a></b> ( const QRectF &amp; <i>viewbox</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QRect </td><td class="memItemRight" valign="bottom"><b><a href="qsvgrenderer.html#viewBox">viewBox</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QRectF </td><td class="memItemRight" valign="bottom"><b><a href="qsvgrenderer.html#viewBox-prop">viewBoxF</a></b> () const</td></tr>
</table>
<ul>
<li><div bar="2" class="fn"></div>29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
</ul>
<hr />
<a name="public-slots"></a>
<h2>Public Slots</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qsvgrenderer.html#load">load</a></b> ( const QString &amp; <i>filename</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qsvgrenderer.html#load-2">load</a></b> ( const QByteArray &amp; <i>contents</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qsvgrenderer.html#load-3">load</a></b> ( QXmlStreamReader * <i>contents</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsvgrenderer.html#render">render</a></b> ( QPainter * <i>painter</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsvgrenderer.html#render-2">render</a></b> ( QPainter * <i>painter</i>, const QRectF &amp; <i>bounds</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsvgrenderer.html#render-3">render</a></b> ( QPainter * <i>painter</i>, const QString &amp; <i>elementId</i>, const QRectF &amp; <i>bounds</i> = QRectF() )</td></tr>
</table>
<ul>
<li><div bar="2" class="fn"></div>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
</ul>
<hr />
<a name="signals"></a>
<h2>Signals</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsvgrenderer.html#repaintNeeded">repaintNeeded</a></b> ()</td></tr>
</table>
<ul>
<li><div bar="2" class="fn"></div>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li><div class="fn"></div>5 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li><div class="fn"></div>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QSvgRenderer class is used to draw the contents of SVG files onto paint devices.</p>
<p>Using QSvgRenderer, Scalable Vector Graphics (SVG) can be rendered onto any <a href="qpaintdevice.html">QPaintDevice</a> subclass, including <a href="qwidget.html">QWidget</a>, <a href="qimage.html">QImage</a>, and <a href="qglwidget.html">QGLWidget</a>.</p>
<p>QSvgRenderer provides an API that supports basic features of SVG rendering, such as loading and rendering of static drawings, and more interactive features like animation. Since the rendering is performed using <a href="qpainter.html">QPainter</a>, SVG drawings can be rendered on any subclass of <a href="qpaintdevice.html">QPaintDevice</a>.</p>
<p>SVG drawings are either loaded when an QSvgRenderer is constructed, or loaded later using the <a href="qsvgrenderer.html#load">load</a>() functions. Data is either supplied directly as serialized XML, or indirectly using a file name. If a valid file has been loaded, either when the renderer is constructed or at some later time, <a href="qsvgrenderer.html#isValid">isValid</a>() returns true; otherwise it returns false. QSvgRenderer provides the <a href="qsvgrenderer.html#render">render</a>() slot to render the current document, or the current frame of an animated document, using a given painter.</p>
<p>The <a href="qsvgrenderer.html#defaultSize">defaultSize</a>() function provides information about the amount of space that is required to render the currently loaded SVG file. This is useful for paint devices, such as <a href="qwidget.html">QWidget</a>, that often need to supply a size hint to their parent layout. The default size of a drawing may differ from its visible area, found using the <a href="qsvgrenderer.html#viewBox-prop">viewBox</a> property.</p>
<p>Animated SVG drawings are supported, and can be controlled with a simple collection of functions and properties:</p>
<ul>
<li>The <a href="qsvgrenderer.html#animated">animated</a>() function indicates whether a drawing contains animation information.</li>
<li>The <a href="qsvgrenderer.html#framesPerSecond-prop">framesPerSecond</a> property contains the rate at which the animation plays.</li>
</ul>
<p>Finally, the QSvgRenderer class provides the <a href="qsvgrenderer.html#repaintNeeded">repaintNeeded</a>() signal which is emitted whenever the rendering of the document needs to be updated.</p>
<p>See also <a href="qsvgwidget.html">QSvgWidget</a>, <a href="qtsvg.html">QtSvg Module</a>, <a href="painting-svgviewer.html">SVG Viewer Example</a>, and <a href="qpicture.html">QPicture</a>.</p>
<hr />
<h2>Property Documentation</h2>
<a name="//apple_ref/cpp/instm/QSvgRenderer/framesPerSecond"></a>
<a name="//apple_ref/cpp/instm/QSvgRenderer/setFramesPerSecond"></a>
<h3 class="fn"><a name="framesPerSecond-prop"></a>framesPerSecond : int</h3>
<p>This property holds the number of frames per second to be shown.</p>
<p>The number of frames per second is 0 if the current document is not animated.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b>framesPerSecond</b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b>setFramesPerSecond</b> ( int <i>num</i> )</td></tr>
</table>
<p>See also <a href="qsvgrenderer.html#animated">animated</a>().</p>
<a name="//apple_ref/cpp/instm/QSvgRenderer/viewBoxF"></a>
<a name="//apple_ref/cpp/instm/QSvgRenderer/setViewBox"></a>
<h3 class="fn"><a name="viewBox-prop"></a>viewBox : <a href="qrectf.html">QRectF</a></h3>
<p>This property holds the rectangle specifying the visible area of the document in logical coordinates.</p>
<p>This property was introduced in Qt 4.2.</p>
<p><b>Access functions:</b></p>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">QRectF </td><td class="memItemRight" valign="bottom"><b>viewBoxF</b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b>setViewBox</b> ( const QRect &amp; <i>viewbox</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b>setViewBox</b> ( const QRectF &amp; <i>viewbox</i> )</td></tr>
</table>
<hr />
<h2>Member Function Documentation</h2>
<a name="//apple_ref/cpp/instm/QSvgRenderer/QSvgRenderer"></a>
<h3 class="fn"><a name="QSvgRenderer"></a>QSvgRenderer::QSvgRenderer ( <a href="qobject.html">QObject</a> * <i>parent</i> = 0 )</h3>
<p>Constructs a new renderer with the given <i>parent</i>.</p>
<h3 class="fn"><a name="QSvgRenderer-2"></a>QSvgRenderer::QSvgRenderer ( const <a href="qstring.html">QString</a> &amp; <i>filename</i>, <a href="qobject.html">QObject</a> * <i>parent</i> = 0 )</h3>
<p>Constructs a new renderer with the given <i>parent</i> and loads the contents of the SVG file with the specified <i>filename</i>.</p>
<h3 class="fn"><a name="QSvgRenderer-3"></a>QSvgRenderer::QSvgRenderer ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>contents</i>, <a href="qobject.html">QObject</a> * <i>parent</i> = 0 )</h3>
<p>Constructs a new renderer with the given <i>parent</i> and loads the SVG data from the byte array specified by <i>contents</i>.</p>
<h3 class="fn"><a name="QSvgRenderer-4"></a>QSvgRenderer::QSvgRenderer ( <a href="qxmlstreamreader.html">QXmlStreamReader</a> * <i>contents</i>, <a href="qobject.html">QObject</a> * <i>parent</i> = 0 )</h3>
<p>Constructs a new renderer with the given <i>parent</i> and loads the SVG data using the stream reader specified by <i>contents</i>.</p>
<p>This function was introduced in Qt 4.5.</p>
<a name="//apple_ref/cpp/instm/QSvgRenderer/~QSvgRenderer"></a>
<h3 class="fn"><a name="dtor.QSvgRenderer"></a>QSvgRenderer::~QSvgRenderer ()</h3>
<p>Destroys the renderer.</p>
<a name="//apple_ref/cpp/instm/QSvgRenderer/animated"></a>
<h3 class="fn"><a name="animated"></a>bool QSvgRenderer::animated () const</h3>
<p>Returns true if the current document contains animated elements; otherwise returns false.</p>
<p>See also <a href="qsvgrenderer.html#framesPerSecond-prop">framesPerSecond</a>().</p>
<a name="//apple_ref/cpp/instm/QSvgRenderer/boundsOnElement"></a>
<h3 class="fn"><a name="boundsOnElement"></a><a href="qrectf.html">QRectF</a> QSvgRenderer::boundsOnElement ( const <a href="qstring.html">QString</a> &amp; <i>id</i> ) const</h3>
<p>Returns bounding rectangle of the item with the given <i>id</i>. The transformation matrix of parent elements is not affecting the bounds of the element.</p>
<p>This function was introduced in Qt 4.2.</p>
<p>See also <a href="qsvgrenderer.html#matrixForElement">matrixForElement</a>().</p>
<a name="//apple_ref/cpp/instm/QSvgRenderer/defaultSize"></a>
<h3 class="fn"><a name="defaultSize"></a><a href="qsize.html">QSize</a> QSvgRenderer::defaultSize () const</h3>
<p>Returns the default size of the document contents.</p>
<a name="//apple_ref/cpp/instm/QSvgRenderer/elementExists"></a>
<h3 class="fn"><a name="elementExists"></a>bool QSvgRenderer::elementExists ( const <a href="qstring.html">QString</a> &amp; <i>id</i> ) const</h3>
<p>Returns true if the element with the given <i>id</i> exists in the currently parsed SVG file and is a renderable element.</p>
<p>Note: this method returns true only for elements that can be rendered. Which implies that elements that are considered part of the fill/stroke style properties, e.g&#x2e; radialGradients even tough marked with &quot;id&quot; attributes will not be found by this method.</p>
<p>This function was introduced in Qt 4.2.</p>
<a name="//apple_ref/cpp/instm/QSvgRenderer/isValid"></a>
<h3 class="fn"><a name="isValid"></a>bool QSvgRenderer::isValid () const</h3>
<p>Returns true if there is a valid current document; otherwise returns false.</p>
<a name="//apple_ref/cpp/instm/QSvgRenderer/load"></a>
<h3 class="fn"><a name="load"></a>bool QSvgRenderer::load ( const <a href="qstring.html">QString</a> &amp; <i>filename</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
<p>Loads the SVG file specified by <i>filename</i>, returning true if the content was successfully parsed; otherwise returns false.</p>
<h3 class="fn"><a name="load-2"></a>bool QSvgRenderer::load ( const <a href="qbytearray.html">QByteArray</a> &amp; <i>contents</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
<p>Loads the specified SVG format <i>contents</i>, returning true if the content was successfully parsed; otherwise returns false.</p>
<h3 class="fn"><a name="load-3"></a>bool QSvgRenderer::load ( <a href="qxmlstreamreader.html">QXmlStreamReader</a> * <i>contents</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
<p>Loads the specified SVG in <i>contents</i>, returning true if the content was successfully parsed; otherwise returns false.</p>
<p>The reader will be used from where it currently is positioned. If <i>contents</i> is <tt>null</tt>, behavior is undefined.</p>
<p>This function was introduced in Qt 4.5.</p>
<a name="//apple_ref/cpp/instm/QSvgRenderer/matrixForElement"></a>
<h3 class="fn"><a name="matrixForElement"></a><a href="qmatrix.html">QMatrix</a> QSvgRenderer::matrixForElement ( const <a href="qstring.html">QString</a> &amp; <i>id</i> ) const</h3>
<p>Returns the transformation matrix for the element with the given <i>id</i>. The matrix is a product of the transformation of the element's parents. The transformation of the element itself is not included.</p>
<p>To find the bounding rectangle of the element in logical coordinates, you can apply the matrix on the rectangle returned from <a href="qsvgrenderer.html#boundsOnElement">boundsOnElement</a>().</p>
<p>This function was introduced in Qt 4.2.</p>
<p>See also <a href="qsvgrenderer.html#boundsOnElement">boundsOnElement</a>().</p>
<a name="//apple_ref/cpp/instm/QSvgRenderer/render"></a>
<h3 class="fn"><a name="render"></a>void QSvgRenderer::render ( <a href="qpainter.html">QPainter</a> * <i>painter</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
<p>Renders the current document, or the current frame of an animated document, using the given <i>painter</i>.</p>
<h3 class="fn"><a name="render-2"></a>void QSvgRenderer::render ( <a href="qpainter.html">QPainter</a> * <i>painter</i>, const <a href="qrectf.html">QRectF</a> &amp; <i>bounds</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
<p>Renders the current document, or the current frame of an animated document, using the given <i>painter</i> on the specified <i>bounds</i> within the painter. If the bounding rectangle is not specified the SVG file is mapped to the whole paint device.</p>
<h3 class="fn"><a name="render-3"></a>void QSvgRenderer::render ( <a href="qpainter.html">QPainter</a> * <i>painter</i>, const <a href="qstring.html">QString</a> &amp; <i>elementId</i>, const <a href="qrectf.html">QRectF</a> &amp; <i>bounds</i> = QRectF() )&nbsp;&nbsp;<tt> [slot]</tt></h3>
<p>Renders the given element with <i>elementId</i> using the given <i>painter</i> on the specified <i>bounds</i>. If the bounding rectangle is not specified the SVG element is mapped to the whole paint device.</p>
<a name="//apple_ref/cpp/instm/QSvgRenderer/repaintNeeded"></a>
<h3 class="fn"><a name="repaintNeeded"></a>void QSvgRenderer::repaintNeeded ()&nbsp;&nbsp;<tt> [signal]</tt></h3>
<p>This signal is emitted whenever the rendering of the document needs to be updated, usually for the purposes of animation.</p>
<a name="//apple_ref/cpp/instm/QSvgRenderer/viewBox"></a>
<h3 class="fn"><a name="viewBox"></a><a href="qrect.html">QRect</a> QSvgRenderer::viewBox () const</h3>
<p>Returns <a href="qsvgrenderer.html#viewBox-prop">viewBoxF</a>().toRect().</p>
<p>See also <a href="qsvgrenderer.html#viewBox-prop">setViewBox</a>() and <a href="qsvgrenderer.html#viewBox-prop">viewBoxF</a>().</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="40%" align="left">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies)</td>
<td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="40%" align="right"><div align="right">Qt 4.6.3</div></td>
</tr></table></div></address></body>
</html>