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 39
|
<?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>QSvgGenerator 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">QSvgGenerator Class Reference<br /><sup><sup>[<a href="qtsvg.html">QtSvg</a> module]</sup></sup></h1><p>The QSvgGenerator class provides a paint device that is used to create SVG drawings. <a href="#details">More...</a></p>
<p>Inherits <a href="qpaintdevice.html">QPaintDevice</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qsvggenerator.html#QSvgGenerator">__init__</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qsvggenerator.html#description">description</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qsvggenerator.html#fileName">fileName</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qsvggenerator.html#metric">metric</a></b> (<i>self</i>, QPaintDevice.PaintDeviceMetric)</li><li><div class="fn" />QIODevice <b><a href="qsvggenerator.html#outputDevice">outputDevice</a></b> (<i>self</i>)</li><li><div class="fn" />QPaintEngine <b><a href="qsvggenerator.html#paintEngine">paintEngine</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qsvggenerator.html#resolution">resolution</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsvggenerator.html#setDescription">setDescription</a></b> (<i>self</i>, QString)</li><li><div class="fn" /><b><a href="qsvggenerator.html#setFileName">setFileName</a></b> (<i>self</i>, QString)</li><li><div class="fn" /><b><a href="qsvggenerator.html#setOutputDevice">setOutputDevice</a></b> (<i>self</i>, QIODevice)</li><li><div class="fn" /><b><a href="qsvggenerator.html#setResolution">setResolution</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qsvggenerator.html#setSize">setSize</a></b> (<i>self</i>, QSize)</li><li><div class="fn" /><b><a href="qsvggenerator.html#setTitle">setTitle</a></b> (<i>self</i>, QString)</li><li><div class="fn" /><b><a href="qsvggenerator.html#setViewBox">setViewBox</a></b> (<i>self</i>, QRect)</li><li><div class="fn" /><b><a href="qsvggenerator.html#setViewBox-2">setViewBox</a></b> (<i>self</i>, QRectF)</li><li><div class="fn" />QSize <b><a href="qsvggenerator.html#size">size</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qsvggenerator.html#title">title</a></b> (<i>self</i>)</li><li><div class="fn" />QRect <b><a href="qsvggenerator.html#viewBox">viewBox</a></b> (<i>self</i>)</li><li><div class="fn" />QRectF <b><a href="qsvggenerator.html#viewBoxF">viewBoxF</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QSvgGenerator class provides a paint device that is used to create SVG drawings.</p>
<p>This paint device represents a Scalable Vector Graphics (SVG) drawing. Like <a href="qprinter.html">QPrinter</a>, it is designed as a write-only device that generates output in a specific format.</p>
<p>To write an SVG file, you first need to configure the output by setting the <a href="qsvggenerator.html#fileName-prop">fileName</a> or <a href="qsvggenerator.html#outputDevice-prop">outputDevice</a> properties. It is usually necessary to specify the size of the drawing by setting the <a href="qsvggenerator.html#size-prop">size</a> property, and in some cases where the drawing will be included in another, the <a href="qsvggenerator.html#viewBox-prop">viewBox</a> property also needs to be set.</p>
<pre> QSvgGenerator generator;
generator.setFileName(path);
generator.setSize(QSize(200, 200));
generator.setViewBox(QRect(0, 0, 200, 200));
generator.setTitle(tr("SVG Generator Example Drawing"));
generator.setDescription(tr("An SVG drawing created by the SVG Generator "
"Example provided with Qt."));</pre>
<p>Other meta-data can be specified by setting the <i>title</i>, <i>description</i> and <i>resolution</i> properties.</p>
<p>As with other <a href="qpaintdevice.html">QPaintDevice</a> subclasses, a <a href="qpainter.html">QPainter</a> object is used to paint onto an instance of this class:</p>
<pre> QPainter painter;
painter.begin(&generator);
...
painter.end();</pre>
<p>Painting is performed in the same way as for any other paint device. However, it is necessary to use the <a href="qpainter.html#begin">QPainter.begin</a>() and <a href="qpainter.html#end">end()</a> to explicitly begin and end painting on the device.</p>
<p>The <a href="painting-svggenerator.html">SVG Generator Example</a> shows how the same painting commands can be used for painting a widget and writing an SVG file.</p>
<p>See also <a href="qsvgrenderer.html">QSvgRenderer</a>, <a href="qsvgwidget.html">QSvgWidget</a>, and <a href="http://www.w3.org/Graphics/SVG/About.html">About SVG</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QSvgGenerator" />QSvgGenerator.__init__ (<i>self</i>)</h3><p>Constructs a new generator.</p>
<a name="//apple_ref/cpp/instm/QSvgGenerator/~QSvgGenerator" />
<h3 class="fn"><a name="description" />QString QSvgGenerator.description (<i>self</i>)</h3><h3 class="fn"><a name="fileName" />QString QSvgGenerator.fileName (<i>self</i>)</h3><h3 class="fn"><a name="metric" />int QSvgGenerator.metric (<i>self</i>, <a href="qpaintdevice.html#PaintDeviceMetric-enum">QPaintDevice.PaintDeviceMetric</a>)</h3><p>Reimplemented from <a href="qpaintdevice.html#metric">QPaintDevice.metric</a>().</p>
<a name="//apple_ref/cpp/instm/QSvgGenerator/paintEngine" />
<h3 class="fn"><a name="outputDevice" /><a href="qiodevice.html">QIODevice</a> QSvgGenerator.outputDevice (<i>self</i>)</h3><h3 class="fn"><a name="paintEngine" /><a href="qpaintengine.html">QPaintEngine</a> QSvgGenerator.paintEngine (<i>self</i>)</h3><p>Reimplemented from <a href="qpaintdevice.html#paintEngine">QPaintDevice.paintEngine</a>().</p>
<p>Returns the paint engine used to render graphics to be converted to SVG format information.</p>
<a name="//apple_ref/cpp/instm/QSvgGenerator/viewBox" />
<h3 class="fn"><a name="resolution" />int QSvgGenerator.resolution (<i>self</i>)</h3><h3 class="fn"><a name="setDescription" />QSvgGenerator.setDescription (<i>self</i>, QString)</h3><h3 class="fn"><a name="setFileName" />QSvgGenerator.setFileName (<i>self</i>, QString)</h3><h3 class="fn"><a name="setOutputDevice" />QSvgGenerator.setOutputDevice (<i>self</i>, <a href="qiodevice.html">QIODevice</a>)</h3><h3 class="fn"><a name="setResolution" />QSvgGenerator.setResolution (<i>self</i>, int)</h3><h3 class="fn"><a name="setSize" />QSvgGenerator.setSize (<i>self</i>, <a href="qsize.html">QSize</a>)</h3><h3 class="fn"><a name="setTitle" />QSvgGenerator.setTitle (<i>self</i>, QString)</h3><h3 class="fn"><a name="setViewBox" />QSvgGenerator.setViewBox (<i>self</i>, <a href="qrect.html">QRect</a>)</h3><h3 class="fn"><a name="setViewBox-2" />QSvgGenerator.setViewBox (<i>self</i>, <a href="qrectf.html">QRectF</a>)</h3><h3 class="fn"><a name="size" /><a href="qsize.html">QSize</a> QSvgGenerator.size (<i>self</i>)</h3><h3 class="fn"><a name="title" />QString QSvgGenerator.title (<i>self</i>)</h3><h3 class="fn"><a name="viewBox" /><a href="qrect.html">QRect</a> QSvgGenerator.viewBox (<i>self</i>)</h3><p>Returns <a href="qsvggenerator.html#viewBox-prop">viewBoxF</a>().toRect().</p>
<p>This function was introduced in Qt 4.5.</p>
<p>See also <a href="qsvggenerator.html#viewBox-prop">setViewBox</a>() and <a href="qsvggenerator.html#viewBox-prop">viewBoxF</a>().</p>
<p /><h3 class="fn"><a name="viewBoxF" /><a href="qrectf.html">QRectF</a> QSvgGenerator.viewBoxF (<i>self</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.7.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt 4.6.2</td></tr></table></div></address></body></html>
|