6
6
td.postheader { font-family: sans-serif }
7
7
tr.address { font-family: sans-serif }
8
8
body { background: #ffffff; color: black; }
9
</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">QPicture Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QPicture class is a paint device that records and replays <a href="qpainter.html">QPainter</a> commands. <a href="#details">More...</a></p>
10
<p>Inherits <a href="qpaintdevice.html">QPaintDevice</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qpicture.html#QPicture">__init__</a></b> (<i>self</i>, int <i>formatVersion</i> = -1)</li><li><div class="fn" /><b><a href="qpicture.html#QPicture-2">__init__</a></b> (<i>self</i>, QPicture)</li><li><div class="fn" />QRect <b><a href="qpicture.html#boundingRect">boundingRect</a></b> (<i>self</i>)</li><li><div class="fn" />str <b><a href="qpicture.html#data">data</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpicture.html#detach">detach</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpicture.html#devType">devType</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpicture.html#isDetached">isDetached</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpicture.html#isNull">isNull</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpicture.html#load">load</a></b> (<i>self</i>, QIODevice, str <i>format</i> = None)</li><li><div class="fn" />bool <b><a href="qpicture.html#load-2">load</a></b> (<i>self</i>, QString, str <i>format</i> = None)</li><li><div class="fn" />int <b><a href="qpicture.html#metric">metric</a></b> (<i>self</i>, QPaintDevice.PaintDeviceMetric)</li><li><div class="fn" />QPaintEngine <b><a href="qpicture.html#paintEngine">paintEngine</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpicture.html#play">play</a></b> (<i>self</i>, QPainter)</li><li><div class="fn" />bool <b><a href="qpicture.html#save">save</a></b> (<i>self</i>, QIODevice, str <i>format</i> = None)</li><li><div class="fn" />bool <b><a href="qpicture.html#save-2">save</a></b> (<i>self</i>, QString, str <i>format</i> = None)</li><li><div class="fn" /><b><a href="qpicture.html#setBoundingRect">setBoundingRect</a></b> (<i>self</i>, QRect)</li><li><div class="fn" /><b><a href="qpicture.html#setData">setData</a></b> (<i>self</i>, str)</li><li><div class="fn" />int <b><a href="qpicture.html#size">size</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />QStringList <b><a href="qpicture.html#inputFormatList">inputFormatList</a></b> ()</li><li><div class="fn" />list-of-QByteArray <b><a href="qpicture.html#inputFormats">inputFormats</a></b> ()</li><li><div class="fn" />QStringList <b><a href="qpicture.html#outputFormatList">outputFormatList</a></b> ()</li><li><div class="fn" />list-of-QByteArray <b><a href="qpicture.html#outputFormats">outputFormats</a></b> ()</li><li><div class="fn" />str <b><a href="qpicture.html#pictureFormat">pictureFormat</a></b> (QString)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QPicture class is a paint device that records and replays <a href="qpainter.html">QPainter</a> commands.</p>
11
<p>A picture serializes painter commands to an IO device in a platform-independent format. They are sometimes referred to as meta-files.</p>
12
<p>Qt pictures use a proprietary binary format. Unlike native picture (meta-file) formats on many window systems, Qt pictures have no limitations regarding their contents. Everything that can be painted on a widget or pixmap (e.g., fonts, pixmaps, regions, transformed graphics, etc.) can also be stored in a picture.</p>
13
<p>QPicture is resolution independent, i.e. a QPicture can be displayed on different devices (for example svg, pdf, ps, printer and screen) looking the same. This is, for instance, needed for WYSIWYG print preview. QPicture runs in the default system dpi, and scales the painter to match differences in resolution depending on the window system.</p>
9
</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">QPicture Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QPicture class is a paint device that records and replays
10
<a href="qpainter.html">QPainter</a> commands. <a href="#details">More...</a></p>
12
<p>Inherits <a href="qpaintdevice.html">QPaintDevice</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qpicture.html#QPicture">__init__</a></b> (<i>self</i>, int <i>formatVersion</i> = -1)</li><li><div class="fn" /><b><a href="qpicture.html#QPicture-2">__init__</a></b> (<i>self</i>, QPicture)</li><li><div class="fn" />QRect <b><a href="qpicture.html#boundingRect">boundingRect</a></b> (<i>self</i>)</li><li><div class="fn" />str <b><a href="qpicture.html#data">data</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qpicture.html#detach">detach</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qpicture.html#devType">devType</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpicture.html#isDetached">isDetached</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpicture.html#isNull">isNull</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpicture.html#load">load</a></b> (<i>self</i>, QIODevice, str <i>format</i> = None)</li><li><div class="fn" />bool <b><a href="qpicture.html#load-2">load</a></b> (<i>self</i>, QString, str <i>format</i> = None)</li><li><div class="fn" />int <b><a href="qpicture.html#metric">metric</a></b> (<i>self</i>, QPaintDevice.PaintDeviceMetric)</li><li><div class="fn" />QPaintEngine <b><a href="qpicture.html#paintEngine">paintEngine</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qpicture.html#play">play</a></b> (<i>self</i>, QPainter)</li><li><div class="fn" />bool <b><a href="qpicture.html#save">save</a></b> (<i>self</i>, QIODevice, str <i>format</i> = None)</li><li><div class="fn" />bool <b><a href="qpicture.html#save-2">save</a></b> (<i>self</i>, QString, str <i>format</i> = None)</li><li><div class="fn" /><b><a href="qpicture.html#setBoundingRect">setBoundingRect</a></b> (<i>self</i>, QRect)</li><li><div class="fn" /><b><a href="qpicture.html#setData">setData</a></b> (<i>self</i>, str)</li><li><div class="fn" />int <b><a href="qpicture.html#size">size</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />QStringList <b><a href="qpicture.html#inputFormatList">inputFormatList</a></b> ()</li><li><div class="fn" />list-of-QByteArray <b><a href="qpicture.html#inputFormats">inputFormats</a></b> ()</li><li><div class="fn" />QStringList <b><a href="qpicture.html#outputFormatList">outputFormatList</a></b> ()</li><li><div class="fn" />list-of-QByteArray <b><a href="qpicture.html#outputFormats">outputFormats</a></b> ()</li><li><div class="fn" />str <b><a href="qpicture.html#pictureFormat">pictureFormat</a></b> (QString)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QPicture class is a paint device that records and replays
13
<a href="qpainter.html">QPainter</a> commands.</p>
14
<p>A picture serializes painter commands to an IO device in a
15
platform-independent format. They are sometimes referred to as
17
<p>Qt pictures use a proprietary binary format. Unlike native
18
picture (meta-file) formats on many window systems, Qt pictures
19
have no limitations regarding their contents. Everything that can
20
be painted on a widget or pixmap (e.g., fonts, pixmaps, regions,
21
transformed graphics, etc.) can also be stored in a picture.</p>
22
<p>QPicture is resolution independent, i.e. a QPicture can be
23
displayed on different devices (for example svg, pdf, ps, printer
24
and screen) looking the same. This is, for instance, needed for
25
WYSIWYG print preview. QPicture runs in the default system dpi, and
26
scales the painter to match differences in resolution depending on
27
the window system.</p>
14
28
<p>Example of how to record a picture:</p>
15
<pre> QPicture picture;
29
<pre class="highlightedCode brush: cpp">
17
32
painter.begin(&picture); <span class="comment">// paint in picture</span>
18
33
painter.drawEllipse(10,20, 80,70); <span class="comment">// draw an ellipse</span>
19
34
painter.end(); <span class="comment">// painting done</span>
20
picture.save("drawing.pic"); <span class="comment">// save picture</span></pre>
21
<p>Note that the list of painter commands is reset on each call to the <a href="qpainter.html#begin">QPainter.begin</a>() function.</p>
35
picture.save("drawing.pic"); <span class="comment">// save picture</span>
37
<p>Note that the list of painter commands is reset on each call to
38
the <a href="qpainter.html#begin">QPainter.begin</a>()
22
40
<p>Example of how to replay a picture:</p>
23
<pre> QPicture picture;
41
<pre class="highlightedCode brush: cpp">
24
43
picture.load("drawing.pic"); <span class="comment">// load picture</span>
26
45
painter.begin(&myImage); <span class="comment">// paint in myImage</span>
27
46
painter.drawPicture(0, 0, picture); <span class="comment">// draw the picture at (0,0)</span>
28
painter.end(); <span class="comment">// painting done</span></pre>
29
<p>Pictures can also be drawn using <a href="qpicture.html#play">play</a>(). Some basic data about a picture is available, for example, <a href="qpicture.html#size">size</a>(), <a href="qpicture.html#isNull">isNull</a>() and <a href="qpicture.html#boundingRect">boundingRect</a>().</p>
30
<p>See also <a href="qmovie.html">QMovie</a>.</p>
47
painter.end(); <span class="comment">// painting done</span>
49
<p>Pictures can also be drawn using <a href="qpicture.html#play">play</a>(). Some basic data about a picture is
50
available, for example, <a href="qpicture.html#size">size</a>(),
51
<a href="qpicture.html#isNull">isNull</a>() and <a href="qpicture.html#boundingRect">boundingRect</a>().</p>
31
52
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QPicture" />QPicture.__init__ (<i>self</i>, int <i>formatVersion</i> = -1)</h3><p>Constructs an empty picture.</p>
32
<p>The <i>formatVersion</i> parameter may be used to <i>create</i> a <a href="qpicture.html">QPicture</a> that can be read by applications that are compiled with earlier versions of Qt.</p>
33
<p>Note that the default formatVersion is -1 which signifies the current release, i.e. for Qt 4.0 a formatVersion of 7 is the same as the default formatVersion of -1.</p>
34
<p>Reading pictures generated by earlier versions of Qt is not supported in Qt 4.0.</p>
53
<p>The <i>formatVersion</i> parameter may be used to <i>create</i>
54
a <a href="qpicture.html">QPicture</a> that can be read by
55
applications that are compiled with earlier versions of Qt.</p>
56
<p>Note that the default formatVersion is -1 which signifies the
57
current release, i.e. for Qt 4.0 a formatVersion of 7 is the same
58
as the default formatVersion of -1.</p>
59
<p>Reading pictures generated by earlier versions of Qt is not
60
supported in Qt 4.0.</p>
35
63
<h3 class="fn"><a name="QPicture-2" />QPicture.__init__ (<i>self</i>, <a href="qpicture.html">QPicture</a>)</h3><p>Constructs a copy of <i>pic</i>.</p>
36
64
<p>This constructor is fast thanks to <a href="implicit-sharing.html">implicit sharing</a>.</p>
37
<a name="//apple_ref/cpp/instm/QPicture/~QPicture" />
38
<h3 class="fn"><a name="boundingRect" /><a href="qrect.html">QRect</a> QPicture.boundingRect (<i>self</i>)</h3><p>Returns the picture's bounding rectangle or an invalid rectangle if the picture contains no data.</p>
67
<h3 class="fn"><a name="boundingRect" /><a href="qrect.html">QRect</a> QPicture.boundingRect (<i>self</i>)</h3><p>Returns the picture's bounding rectangle or an invalid rectangle
68
if the picture contains no data.</p>
39
69
<p>See also <a href="qpicture.html#setBoundingRect">setBoundingRect</a>().</p>
40
<a name="//apple_ref/cpp/instm/QPicture/data" />
41
<h3 class="fn"><a name="data" />str QPicture.data (<i>self</i>)</h3><p>Returns a pointer to the picture data. The pointer is only valid until the next non-const function is called on this picture. The returned pointer is 0 if the picture contains no data.</p>
72
<h3 class="fn"><a name="data" />str QPicture.data (<i>self</i>)</h3><p>Returns a pointer to the picture data. The pointer is only valid
73
until the next non-const function is called on this picture. The
74
returned pointer is 0 if the picture contains no data.</p>
42
75
<p>See also <a href="qpicture.html#setData">setData</a>(), <a href="qpicture.html#size">size</a>(), and <a href="qpicture.html#isNull">isNull</a>().</p>
43
<a name="//apple_ref/cpp/instm/QPicture/isNull" />
44
<h3 class="fn"><a name="detach" />QPicture.detach (<i>self</i>)</h3><h3 class="fn"><a name="devType" />int QPicture.devType (<i>self</i>)</h3><h3 class="fn"><a name="inputFormatList" />QStringList QPicture.inputFormatList ()</h3><h3 class="fn"><a name="inputFormats" />list-of-QByteArray QPicture.inputFormats ()</h3><h3 class="fn"><a name="isDetached" />bool QPicture.isDetached (<i>self</i>)</h3><h3 class="fn"><a name="isNull" />bool QPicture.isNull (<i>self</i>)</h3><p>Returns true if the picture contains no data; otherwise returns false.</p>
45
<a name="//apple_ref/cpp/instm/QPicture/load" />
46
<h3 class="fn"><a name="load" />bool QPicture.load (<i>self</i>, <a href="qiodevice.html">QIODevice</a>, str <i>format</i> = None)</h3><p>Loads a picture from the file specified by <i>fileName</i> and returns true if successful; otherwise returns false.</p>
47
<p>Please note that the <i>format</i> parameter has been deprecated and will have no effect.</p>
78
<h3 class="fn"><a name="detach" />QPicture.detach (<i>self</i>)</h3><h3 class="fn"><a name="devType" />int QPicture.devType (<i>self</i>)</h3><h3 class="fn"><a name="inputFormatList" />QStringList QPicture.inputFormatList ()</h3><h3 class="fn"><a name="inputFormats" />list-of-QByteArray QPicture.inputFormats ()</h3><h3 class="fn"><a name="isDetached" />bool QPicture.isDetached (<i>self</i>)</h3><h3 class="fn"><a name="isNull" />bool QPicture.isNull (<i>self</i>)</h3><p>Returns true if the picture contains no data; otherwise returns
82
<h3 class="fn"><a name="load" />bool QPicture.load (<i>self</i>, <a href="qiodevice.html">QIODevice</a>, str <i>format</i> = None)</h3><p>Loads a picture from the file specified by <i>fileName</i> and
83
returns true if successful; otherwise returns false.</p>
84
<p>Please note that the <i>format</i> parameter has been deprecated
85
and will have no effect.</p>
48
86
<p>See also <a href="qpicture.html#save">save</a>().</p>
49
89
<h3 class="fn"><a name="load-2" />bool QPicture.load (<i>self</i>, QString, str <i>format</i> = None)</h3><p>This is an overloaded function.</p>
50
90
<p><i>dev</i> is the device to use for loading.</p>
51
<a name="//apple_ref/cpp/instm/QPicture/play" />
52
<h3 class="fn"><a name="metric" />int QPicture.metric (<i>self</i>, <a href="qpaintdevice.html#PaintDeviceMetric-enum">QPaintDevice.PaintDeviceMetric</a>)</h3><h3 class="fn"><a name="outputFormatList" />QStringList QPicture.outputFormatList ()</h3><h3 class="fn"><a name="outputFormats" />list-of-QByteArray QPicture.outputFormats ()</h3><h3 class="fn"><a name="paintEngine" /><a href="qpaintengine.html">QPaintEngine</a> QPicture.paintEngine (<i>self</i>)</h3><h3 class="fn"><a name="pictureFormat" />str QPicture.pictureFormat (QString)</h3><h3 class="fn"><a name="play" />bool QPicture.play (<i>self</i>, <a href="qpainter.html">QPainter</a>)</h3><p>Replays the picture using <i>painter</i>, and returns true if successful; otherwise returns false.</p>
53
<p>This function does exactly the same as <a href="qpainter.html#drawPicture">QPainter.drawPicture</a>() with (x, y) = (0, 0).</p>
54
<a name="//apple_ref/cpp/instm/QPicture/save" />
55
<h3 class="fn"><a name="save" />bool QPicture.save (<i>self</i>, <a href="qiodevice.html">QIODevice</a>, str <i>format</i> = None)</h3><p>Saves a picture to the file specified by <i>fileName</i> and returns true if successful; otherwise returns false.</p>
56
<p>Please note that the <i>format</i> parameter has been deprecated and will have no effect.</p>
93
<h3 class="fn"><a name="metric" />int QPicture.metric (<i>self</i>, <a href="qpaintdevice.html#PaintDeviceMetric-enum">QPaintDevice.PaintDeviceMetric</a>)</h3><h3 class="fn"><a name="outputFormatList" />QStringList QPicture.outputFormatList ()</h3><h3 class="fn"><a name="outputFormats" />list-of-QByteArray QPicture.outputFormats ()</h3><h3 class="fn"><a name="paintEngine" /><a href="qpaintengine.html">QPaintEngine</a> QPicture.paintEngine (<i>self</i>)</h3><h3 class="fn"><a name="pictureFormat" />str QPicture.pictureFormat (QString)</h3><h3 class="fn"><a name="play" />bool QPicture.play (<i>self</i>, <a href="qpainter.html">QPainter</a>)</h3><p>Replays the picture using <i>painter</i>, and returns true if
94
successful; otherwise returns false.</p>
95
<p>This function does exactly the same as <a href="qpainter.html#drawPicture">QPainter.drawPicture</a>() with (x, y)
99
<h3 class="fn"><a name="save" />bool QPicture.save (<i>self</i>, <a href="qiodevice.html">QIODevice</a>, str <i>format</i> = None)</h3><p>Saves a picture to the file specified by <i>fileName</i> and
100
returns true if successful; otherwise returns false.</p>
101
<p>Please note that the <i>format</i> parameter has been deprecated
102
and will have no effect.</p>
57
103
<p>See also <a href="qpicture.html#load">load</a>().</p>
58
106
<h3 class="fn"><a name="save-2" />bool QPicture.save (<i>self</i>, QString, str <i>format</i> = None)</h3><p>This is an overloaded function.</p>
59
107
<p><i>dev</i> is the device to use for saving.</p>
60
<a name="//apple_ref/cpp/instm/QPicture/setBoundingRect" />
61
<h3 class="fn"><a name="setBoundingRect" />QPicture.setBoundingRect (<i>self</i>, <a href="qrect.html">QRect</a>)</h3><p>Sets the picture's bounding rectangle to <i>r</i>. The automatically calculated value is overridden.</p>
110
<h3 class="fn"><a name="setBoundingRect" />QPicture.setBoundingRect (<i>self</i>, <a href="qrect.html">QRect</a>)</h3><p>Sets the picture's bounding rectangle to <i>r</i>. The
111
automatically calculated value is overridden.</p>
62
112
<p>See also <a href="qpicture.html#boundingRect">boundingRect</a>().</p>
63
<a name="//apple_ref/cpp/instm/QPicture/setData" />
64
<h3 class="fn"><a name="setData" />QPicture.setData (<i>self</i>, str)</h3><p>Sets the picture data directly from <i>data</i> and <i>size</i>. This function copies the input data.</p>
115
<h3 class="fn"><a name="setData" />QPicture.setData (<i>self</i>, str)</h3><p>Sets the picture data directly from <i>data</i> and <i>size</i>.
116
This function copies the input data.</p>
65
117
<p>See also <a href="qpicture.html#data">data</a>() and <a href="qpicture.html#size">size</a>().</p>
66
<a name="//apple_ref/cpp/instm/QPicture/size" />
67
120
<h3 class="fn"><a name="size" />int QPicture.size (<i>self</i>)</h3><p>Returns the size of the picture data.</p>
68
121
<p>See also <a href="qpicture.html#data">data</a>().</p>
69
<a name="//apple_ref/cpp/instm/QPicture/operator=" />
70
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.7.7 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.3</td></tr></table></div></address></body></html>
b'\\ No newline at end of file'
124
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.8.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.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt 4.7.0</td></tr></table></div></address></body></html>
b'\\ No newline at end of file'