File: qgraphicspixmapitem.html

package info (click to toggle)
python-qt4 4.9.3-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 34,432 kB
  • sloc: python: 34,126; cpp: 11,938; xml: 290; makefile: 223; php: 27
file content (153 lines) | stat: -rw-r--r-- 15,219 bytes parent folder | download
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?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>QGraphicsPixmapItem 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">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QGraphicsPixmapItem Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QGraphicsPixmapItem class provides a pixmap item that you
can add to a <a href="qgraphicsscene.html">QGraphicsScene</a>.
<a href="#details">More...</a></p>

<p>Inherits <a href="qgraphicsitem.html">QGraphicsItem</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qgraphicspixmapitem.html#ShapeMode-enum">ShapeMode</a></b> { MaskShape, BoundingRectShape, HeuristicMaskShape }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qgraphicspixmapitem.html#QGraphicsPixmapItem">__init__</a></b> (<i>self</i>, QGraphicsItem&#160;<i>parent</i>&#160;=&#160;None, QGraphicsScene&#160;<i>scene</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qgraphicspixmapitem.html#QGraphicsPixmapItem-2">__init__</a></b> (<i>self</i>, QPixmap&#160;<i>pixmap</i>, QGraphicsItem&#160;<i>parent</i>&#160;=&#160;None, QGraphicsScene&#160;<i>scene</i>&#160;=&#160;None)</li><li><div class="fn" />QRectF <b><a href="qgraphicspixmapitem.html#boundingRect">boundingRect</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qgraphicspixmapitem.html#contains">contains</a></b> (<i>self</i>, QPointF&#160;<i>point</i>)</li><li><div class="fn" />bool <b><a href="qgraphicspixmapitem.html#isObscuredBy">isObscuredBy</a></b> (<i>self</i>, QGraphicsItem&#160;<i>item</i>)</li><li><div class="fn" />QPointF <b><a href="qgraphicspixmapitem.html#offset">offset</a></b> (<i>self</i>)</li><li><div class="fn" />QPainterPath <b><a href="qgraphicspixmapitem.html#opaqueArea">opaqueArea</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qgraphicspixmapitem.html#paint">paint</a></b> (<i>self</i>, QPainter&#160;<i>painter</i>, QStyleOptionGraphicsItem&#160;<i>option</i>, QWidget&#160;<i>widget</i>)</li><li><div class="fn" />QPixmap <b><a href="qgraphicspixmapitem.html#pixmap">pixmap</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qgraphicspixmapitem.html#setOffset">setOffset</a></b> (<i>self</i>, QPointF&#160;<i>offset</i>)</li><li><div class="fn" /><b><a href="qgraphicspixmapitem.html#setOffset-2">setOffset</a></b> (<i>self</i>, float&#160;<i>ax</i>, float&#160;<i>ay</i>)</li><li><div class="fn" /><b><a href="qgraphicspixmapitem.html#setPixmap">setPixmap</a></b> (<i>self</i>, QPixmap&#160;<i>pixmap</i>)</li><li><div class="fn" /><b><a href="qgraphicspixmapitem.html#setShapeMode">setShapeMode</a></b> (<i>self</i>, ShapeMode&#160;<i>mode</i>)</li><li><div class="fn" /><b><a href="qgraphicspixmapitem.html#setTransformationMode">setTransformationMode</a></b> (<i>self</i>, Qt.TransformationMode&#160;<i>mode</i>)</li><li><div class="fn" />QPainterPath <b><a href="qgraphicspixmapitem.html#shape">shape</a></b> (<i>self</i>)</li><li><div class="fn" />ShapeMode <b><a href="qgraphicspixmapitem.html#shapeMode">shapeMode</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.TransformationMode <b><a href="qgraphicspixmapitem.html#transformationMode">transformationMode</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qgraphicspixmapitem.html#type">type</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QGraphicsPixmapItem class provides a pixmap item that you
can add to a <a href="qgraphicsscene.html">QGraphicsScene</a>.</p>
<p>To set the item's pixmap, pass a <a href="qpixmap.html">QPixmap</a> to QGraphicsPixmapItem's constructor, or
call the <a href="qgraphicspixmapitem.html#setPixmap">setPixmap</a>() function. The
<a href="qgraphicspixmapitem.html#pixmap">pixmap</a>() function
returns the current pixmap.</p>
<p>QGraphicsPixmapItem uses pixmap's optional alpha mask to provide
a reasonable implementation of <a href="qgraphicspixmapitem.html#boundingRect">boundingRect</a>(),
<a href="qgraphicspixmapitem.html#shape">shape</a>(), and <a href="qgraphicspixmapitem.html#contains">contains</a>().</p>
<p class="centerAlign"><img alt="" src="images/graphicsview-pixmapitem.png" /></p>
<p>The pixmap is drawn at the item's (0, 0) coordinate, as returned
by <a href="qgraphicspixmapitem.html#offset">offset</a>(). You can
change the drawing offset by calling <a href="qgraphicspixmapitem.html#setOffset">setOffset</a>().</p>
<p>You can set the pixmap's transformation mode by calling <a href="qgraphicspixmapitem.html#setTransformationMode">setTransformationMode</a>().
By default, <a href="qt.html#TransformationMode-enum">Qt.FastTransformation</a> is
used, which provides fast, non-smooth scaling. <a href="qt.html#TransformationMode-enum">Qt.SmoothTransformation</a>
enables <a href="qpainter.html#RenderHint-enum">QPainter.SmoothPixmapTransform</a>
on the painter, and the quality depends on the platform and
viewport. The result is usually not as good as calling
QPixmap.scale() directly. Call <a href="qgraphicspixmapitem.html#transformationMode">transformationMode</a>()
to get the current transformation mode for the item.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="ShapeMode-enum" />QGraphicsPixmapItem.ShapeMode</h3><p>This enum describes how <a href="qgraphicspixmapitem.html">QGraphicsPixmapItem</a> calculates its
shape and opaque area.</p>
<p>The default value is MaskShape.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QGraphicsPixmapItem.MaskShape</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">The shape is determined by calling <a href="qpixmap.html#mask">QPixmap.mask</a>(). This shape includes only
the opaque pixels of the pixmap. Because the shape is more complex,
however, it can be slower than the other modes, and uses more
memory.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QGraphicsPixmapItem.BoundingRectShape</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">The shape is determined by tracing the outline
of the pixmap. This is the fastest shape mode, but it does not take
into account any transparent areas on the pixmap.</td>
</tr>
<tr>
<td class="topAlign">
<tt>QGraphicsPixmapItem.HeuristicMaskShape</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">The shape is determine by calling <a href="qpixmap.html#createHeuristicMask">QPixmap.createHeuristicMask</a>().
The performance and memory consumption is similar to
MaskShape.</td>
</tr>
</table>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QGraphicsPixmapItem" />QGraphicsPixmapItem.__init__ (<i>self</i>, <a href="qgraphicsitem.html">QGraphicsItem</a>&#160;<i>parent</i>&#160;=&#160;None, <a href="qgraphicsscene.html">QGraphicsScene</a>&#160;<i>scene</i>&#160;=&#160;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>The <i>scene</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a <a href="qgraphicspixmapitem.html">QGraphicsPixmapItem</a>. <i>parent</i>
is passed to <a href="qgraphicsitem.html">QGraphicsItem</a>'s
constructor.</p>
<p><b>See also</b> <a href="qgraphicsscene.html#addItem">QGraphicsScene.addItem</a>().</p>


<h3 class="fn"><a name="QGraphicsPixmapItem-2" />QGraphicsPixmapItem.__init__ (<i>self</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pixmap</i>, <a href="qgraphicsitem.html">QGraphicsItem</a>&#160;<i>parent</i>&#160;=&#160;None, <a href="qgraphicsscene.html">QGraphicsScene</a>&#160;<i>scene</i>&#160;=&#160;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>The <i>scene</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a <a href="qgraphicspixmapitem.html">QGraphicsPixmapItem</a>, using
<i>pixmap</i> as the default pixmap. <i>parent</i> is passed to
<a href="qgraphicsitem.html">QGraphicsItem</a>'s constructor.</p>
<p><b>See also</b> <a href="qgraphicsscene.html#addItem">QGraphicsScene.addItem</a>().</p>


<h3 class="fn"><a name="boundingRect" /><a href="qrectf.html">QRectF</a> QGraphicsPixmapItem.boundingRect (<i>self</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#boundingRect">QGraphicsItem.boundingRect</a>().</p>


<h3 class="fn"><a name="contains" />bool QGraphicsPixmapItem.contains (<i>self</i>, <a href="qpointf.html">QPointF</a>&#160;<i>point</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#contains">QGraphicsItem.contains</a>().</p>


<h3 class="fn"><a name="isObscuredBy" />bool QGraphicsPixmapItem.isObscuredBy (<i>self</i>, <a href="qgraphicsitem.html">QGraphicsItem</a>&#160;<i>item</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#isObscuredBy">QGraphicsItem.isObscuredBy</a>().</p>


<h3 class="fn"><a name="offset" /><a href="qpointf.html">QPointF</a> QGraphicsPixmapItem.offset (<i>self</i>)</h3><p>Returns the pixmap item's <i>offset</i>, which defines the point
of the top-left corner of the pixmap, in local coordinates.</p>
<p><b>See also</b> <a href="qgraphicspixmapitem.html#setOffset">setOffset</a>().</p>


<h3 class="fn"><a name="opaqueArea" /><a href="qpainterpath.html">QPainterPath</a> QGraphicsPixmapItem.opaqueArea (<i>self</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#opaqueArea">QGraphicsItem.opaqueArea</a>().</p>


<h3 class="fn"><a name="paint" />QGraphicsPixmapItem.paint (<i>self</i>, <a href="qpainter.html">QPainter</a>&#160;<i>painter</i>, <a href="qstyleoptiongraphicsitem.html">QStyleOptionGraphicsItem</a>&#160;<i>option</i>, <a href="qwidget.html">QWidget</a>&#160;<i>widget</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#paint">QGraphicsItem.paint</a>().</p>


<h3 class="fn"><a name="pixmap" /><a href="qpixmap.html">QPixmap</a> QGraphicsPixmapItem.pixmap (<i>self</i>)</h3><p>Returns the item's pixmap, or an invalid <a href="qpixmap.html">QPixmap</a> if no pixmap has been set.</p>
<p><b>See also</b> <a href="qgraphicspixmapitem.html#setPixmap">setPixmap</a>().</p>


<h3 class="fn"><a name="setOffset" />QGraphicsPixmapItem.setOffset (<i>self</i>, <a href="qpointf.html">QPointF</a>&#160;<i>offset</i>)</h3><p>Sets the pixmap item's offset to <i>offset</i>. <a href="qgraphicspixmapitem.html">QGraphicsPixmapItem</a> will draw its
pixmap using <i>offset</i> for its top-left corner.</p>
<p><b>See also</b> <a href="qgraphicspixmapitem.html#offset">offset</a>().</p>


<h3 class="fn"><a name="setOffset-2" />QGraphicsPixmapItem.setOffset (<i>self</i>, float&#160;<i>ax</i>, float&#160;<i>ay</i>)</h3><p>This convenience function is equivalent to calling
setOffset(<a href="qpointf.html">QPointF</a>(<i>x</i>,
<i>y</i>)).</p>
<p>This function was introduced in Qt 4.3.</p>


<h3 class="fn"><a name="setPixmap" />QGraphicsPixmapItem.setPixmap (<i>self</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pixmap</i>)</h3><p>Sets the item's pixmap to <i>pixmap</i>.</p>
<p><b>See also</b> <a href="qgraphicspixmapitem.html#pixmap">pixmap</a>().</p>


<h3 class="fn"><a name="setShapeMode" />QGraphicsPixmapItem.setShapeMode (<i>self</i>, <a href="qgraphicspixmapitem.html#ShapeMode-enum">ShapeMode</a>&#160;<i>mode</i>)</h3><p>Sets the item's shape mode to <i>mode</i>. The shape mode
describes how <a href="qgraphicspixmapitem.html">QGraphicsPixmapItem</a> calculates its
shape. The default mode is <a href="qgraphicspixmapitem.html#ShapeMode-enum">MaskShape</a>.</p>
<p><b>See also</b> <a href="qgraphicspixmapitem.html#shapeMode">shapeMode</a>() and <a href="qgraphicspixmapitem.html#ShapeMode-enum">ShapeMode</a>.</p>


<h3 class="fn"><a name="setTransformationMode" />QGraphicsPixmapItem.setTransformationMode (<i>self</i>, <a href="qt.html#TransformationMode-enum">Qt.TransformationMode</a>&#160;<i>mode</i>)</h3><p>Sets the pixmap item's transformation mode to <i>mode</i>, and
toggles an update of the item. The default mode is <a href="qt.html#TransformationMode-enum">Qt.FastTransformation</a>, which
provides quick transformation with no smoothing.</p>
<p><a href="qt.html#TransformationMode-enum">Qt.SmoothTransformation</a>
enables <a href="qpainter.html#RenderHint-enum">QPainter.SmoothPixmapTransform</a>
on the painter, and the quality depends on the platform and
viewport. The result is usually not as good as calling
QPixmap.scale() directly.</p>
<p><b>See also</b> <a href="qgraphicspixmapitem.html#transformationMode">transformationMode</a>().</p>


<h3 class="fn"><a name="shape" /><a href="qpainterpath.html">QPainterPath</a> QGraphicsPixmapItem.shape (<i>self</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#shape">QGraphicsItem.shape</a>().</p>


<h3 class="fn"><a name="shapeMode" /><a href="qgraphicspixmapitem.html#ShapeMode-enum">ShapeMode</a> QGraphicsPixmapItem.shapeMode (<i>self</i>)</h3><p>Returns the item's shape mode. The shape mode describes how
<a href="qgraphicspixmapitem.html">QGraphicsPixmapItem</a>
calculates its shape. The default mode is <a href="qgraphicspixmapitem.html#ShapeMode-enum">MaskShape</a>.</p>
<p><b>See also</b> <a href="qgraphicspixmapitem.html#setShapeMode">setShapeMode</a>() and
<a href="qgraphicspixmapitem.html#ShapeMode-enum">ShapeMode</a>.</p>


<h3 class="fn"><a name="transformationMode" /><a href="qt.html#TransformationMode-enum">Qt.TransformationMode</a> QGraphicsPixmapItem.transformationMode (<i>self</i>)</h3><p>Returns the transformation mode of the pixmap. The default mode
is <a href="qt.html#TransformationMode-enum">Qt.FastTransformation</a>, which
provides quick transformation with no smoothing.</p>
<p><b>See also</b> <a href="qgraphicspixmapitem.html#setTransformationMode">setTransformationMode</a>().</p>


<h3 class="fn"><a name="type" />int QGraphicsPixmapItem.type (<i>self</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#type">QGraphicsItem.type</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.2</td></tr></table></div></address></body></html>