1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QSvgRenderer Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QSvgRenderer Class Reference<br /><sup><sup>[<a href="qtsvg.html">QtSvg</a> module]</sup></sup></h1><p>The QSvgRenderer class is used to draw the contents of SVG files onto paint devices. <a href="#details">More...</a></p>
<p>Inherits <a href="qobject.html">QObject</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qsvgrenderer.html#QSvgRenderer">__init__</a></b> (<i>self</i>, QObject <i>parent</i> = None)</li><li><div class="fn" /><b><a href="qsvgrenderer.html#QSvgRenderer-2">__init__</a></b> (<i>self</i>, QString <i>filename</i>, QObject <i>parent</i> = None)</li><li><div class="fn" /><b><a href="qsvgrenderer.html#QSvgRenderer-3">__init__</a></b> (<i>self</i>, QByteArray <i>contents</i>, QObject <i>parent</i> = None)</li><li><div class="fn" />bool <b><a href="qsvgrenderer.html#animated">animated</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qsvgrenderer.html#animationDuration">animationDuration</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qsvgrenderer.html#currentFrame">currentFrame</a></b> (<i>self</i>)</li><li><div class="fn" />QSize <b><a href="qsvgrenderer.html#defaultSize">defaultSize</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qsvgrenderer.html#framesPerSecond">framesPerSecond</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsvgrenderer.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsvgrenderer.html#load">load</a></b> (<i>self</i>, QString <i>filename</i>)</li><li><div class="fn" />bool <b><a href="qsvgrenderer.html#load-2">load</a></b> (<i>self</i>, QByteArray <i>contents</i>)</li><li><div class="fn" /><b><a href="qsvgrenderer.html#render">render</a></b> (<i>self</i>, QPainter <i>p</i>)</li><li><div class="fn" /><b><a href="qsvgrenderer.html#setCurrentFrame">setCurrentFrame</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qsvgrenderer.html#setFramesPerSecond">setFramesPerSecond</a></b> (<i>self</i>, int <i>num</i>)</li><li><div class="fn" /><b><a href="qsvgrenderer.html#setViewBox">setViewBox</a></b> (<i>self</i>, QRect <i>viewbox</i>)</li><li><div class="fn" />QRect <b><a href="qsvgrenderer.html#viewBox">viewBox</a></b> (<i>self</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qsvgrenderer.html#repaintNeeded">repaintNeeded</a></b> ()</li></ul><a name="details" /><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 animationDuration() function provides the duration in milliseconds of the animation, without taking any looping into account.</li>
<li>The currentFrame property contains the current frame of the animation.</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>Method Documentation</h2><h3 class="fn"><a name="QSvgRenderer" />QSvgRenderer.__init__ (<i>self</i>, <a href="qobject.html">QObject</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a new renderer with the given <i>parent</i>.</p>
<h3 class="fn"><a name="QSvgRenderer-2" />QSvgRenderer.__init__ (<i>self</i>, <a href="qstring.html">QString</a> <i>filename</i>, <a href="qobject.html">QObject</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><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" />QSvgRenderer.__init__ (<i>self</i>, <a href="qbytearray.html">QByteArray</a> <i>contents</i>, <a href="qobject.html">QObject</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a new renderer with the given <i>parent</i> and loads the specified SVG format <i>contents</i>.</p>
<h3 class="fn"><a name="animated" />bool QSvgRenderer.animated (<i>self</i>)</h3><p>Returns true if the current document contains animated elements; otherwise returns false.</p>
<p>See also <a href="qsvgrenderer.html#currentFrame">currentFrame</a>(), animationDuration(), and <a href="qsvgrenderer.html#framesPerSecond-prop">framesPerSecond</a>().</p>
<h3 class="fn"><a name="animationDuration" />int QSvgRenderer.animationDuration (<i>self</i>)</h3><h3 class="fn"><a name="currentFrame" />int QSvgRenderer.currentFrame (<i>self</i>)</h3><p>See also <a href="qsvgrenderer.html#setCurrentFrame">setCurrentFrame</a>().</p>
<h3 class="fn"><a name="defaultSize" /><a href="qsize.html">QSize</a> QSvgRenderer.defaultSize (<i>self</i>)</h3><p>Returns the default size of the document contents.</p>
<h3 class="fn"><a name="framesPerSecond" />int QSvgRenderer.framesPerSecond (<i>self</i>)</h3><h3 class="fn"><a name="isValid" />bool QSvgRenderer.isValid (<i>self</i>)</h3><p>Returns true if there is a valid current document; otherwise returns false.</p>
<h3 class="fn"><a name="load" />bool QSvgRenderer.load (<i>self</i>, <a href="qstring.html">QString</a> <i>filename</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>bool load(const QString&)</tt>.</p><p>Loads the SVG file specified by <i>filename</i>.</p>
<h3 class="fn"><a name="load-2" />bool QSvgRenderer.load (<i>self</i>, <a href="qbytearray.html">QByteArray</a> <i>contents</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>bool load(const QByteArray&)</tt>.</p><p>This is an overloaded member function, provided for convenience.</p>
<p>Loads the specified SVG format <i>contents</i>.</p>
<h3 class="fn"><a name="render" />QSvgRenderer.render (<i>self</i>, <a href="qpainter.html">QPainter</a> <i>p</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void render(QPainter *)</tt>.</p><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="setCurrentFrame" />QSvgRenderer.setCurrentFrame (<i>self</i>, int)</h3><p>See also <a href="qsvgrenderer.html#currentFrame">currentFrame</a>().</p>
<h3 class="fn"><a name="setFramesPerSecond" />QSvgRenderer.setFramesPerSecond (<i>self</i>, int <i>num</i>)</h3><h3 class="fn"><a name="setViewBox" />QSvgRenderer.setViewBox (<i>self</i>, <a href="qrect.html">QRect</a> <i>viewbox</i>)</h3><h3 class="fn"><a name="viewBox" /><a href="qrect.html">QRect</a> QSvgRenderer.viewBox (<i>self</i>)</h3><hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="repaintNeeded" />void repaintNeeded ()</h3><p>This signal is emitted whenever the rendering of the document needs to be updated, usually for the purposes of animation.</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td width="25%">PyQt 4.0.1 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.trolltech.com">Trolltech AS</a> 2006</td><td align="right" width="25%">Qt 4.1.4</td></tr></table></div></address></body></html>
|