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">QGraphicsItemGroup Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QGraphicsItemGroup class provides treating a group of items as one. <a href="#details">More...</a></p>
10
<p>Inherits <a href="qgraphicsitem.html">QGraphicsItem</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qgraphicsitemgroup.html#QGraphicsItemGroup">__init__</a></b> (<i>self</i>, QGraphicsItem <i>parent</i> = None, QGraphicsScene <i>scene</i> = None)</li><li><div class="fn" /><b><a href="qgraphicsitemgroup.html#addToGroup">addToGroup</a></b> (<i>self</i>, QGraphicsItem)</li><li><div class="fn" />QRectF <b><a href="qgraphicsitemgroup.html#boundingRect">boundingRect</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qgraphicsitemgroup.html#isObscuredBy">isObscuredBy</a></b> (<i>self</i>, QGraphicsItem)</li><li><div class="fn" />QPainterPath <b><a href="qgraphicsitemgroup.html#opaqueArea">opaqueArea</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qgraphicsitemgroup.html#paint">paint</a></b> (<i>self</i>, QPainter, QStyleOptionGraphicsItem, QWidget <i>widget</i> = None)</li><li><div class="fn" /><b><a href="qgraphicsitemgroup.html#removeFromGroup">removeFromGroup</a></b> (<i>self</i>, QGraphicsItem)</li><li><div class="fn" />int <b><a href="qgraphicsitemgroup.html#type">type</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QGraphicsItemGroup class provides treating a group of items as one.</p>
11
<p>A QGraphicsItemGroup is a special type of compound item that treats itself and all its children as one item (i.e., all events and geometries for all children are merged together). It's common to use item groups in presentation tools, when the user wants to group several smaller items into one big item in order to simplify moving and copying of items.</p>
12
<p>If all you want is to store items inside other items, you can use any <a href="qgraphicsitem.html">QGraphicsItem</a> directly by passing a suitable parent to <a href="qgraphicsitem.html#setParentItem">setParentItem</a>().</p>
13
<p>The <a href="qgraphicsitemgroup.html#boundingRect">boundingRect</a>() function of QGraphicsItemGroup returns the bounding rectangle of all items in the item group. QGraphicsItemGroup ignores the <a href="qgraphicsitem.html#GraphicsItemFlag-enum">ItemIgnoresTransformations</a> flag on its children (i.e., with respect to the geometry of the group item, the children are treated as if they were transformable).</p>
14
<p>There are two ways to construct an item group. The easiest and most common approach is to pass a list of items (e.g., all selected items) to <a href="qgraphicsscene.html#createItemGroup">QGraphicsScene.createItemGroup</a>(), which returns a new QGraphicsItemGroup item. The other approach is to manually construct a QGraphicsItemGroup item, add it to the scene calling <a href="qgraphicsscene.html#addItem">QGraphicsScene.addItem</a>(), and then add items to the group manually, one at a time by calling <a href="qgraphicsitemgroup.html#addToGroup">addToGroup</a>(). To dismantle ("ungroup") an item group, you can either call <a href="qgraphicsscene.html#destroyItemGroup">QGraphicsScene.destroyItemGroup</a>(), or you can manually remove all items from the group by calling <a href="qgraphicsitemgroup.html#removeFromGroup">removeFromGroup</a>().</p>
15
<pre><span class="comment"> // Group all selected items together</span>
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">QGraphicsItemGroup Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QGraphicsItemGroup class provides treating a group of items
10
as one. <a href="#details">More...</a></p>
12
<p>Inherits <a href="qgraphicsitem.html">QGraphicsItem</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qgraphicsitemgroup.html#QGraphicsItemGroup">__init__</a></b> (<i>self</i>, QGraphicsItem <i>parent</i> = None, QGraphicsScene <i>scene</i> = None)</li><li><div class="fn" /><b><a href="qgraphicsitemgroup.html#addToGroup">addToGroup</a></b> (<i>self</i>, QGraphicsItem)</li><li><div class="fn" />QRectF <b><a href="qgraphicsitemgroup.html#boundingRect">boundingRect</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qgraphicsitemgroup.html#isObscuredBy">isObscuredBy</a></b> (<i>self</i>, QGraphicsItem)</li><li><div class="fn" />QPainterPath <b><a href="qgraphicsitemgroup.html#opaqueArea">opaqueArea</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qgraphicsitemgroup.html#paint">paint</a></b> (<i>self</i>, QPainter, QStyleOptionGraphicsItem, QWidget <i>widget</i> = None)</li><li><div class="fn" /><b><a href="qgraphicsitemgroup.html#removeFromGroup">removeFromGroup</a></b> (<i>self</i>, QGraphicsItem)</li><li><div class="fn" />int <b><a href="qgraphicsitemgroup.html#type">type</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QGraphicsItemGroup class provides treating a group of items
14
<p>A QGraphicsItemGroup is a special type of compound item that
15
treats itself and all its children as one item (i.e., all events
16
and geometries for all children are merged together). It's common
17
to use item groups in presentation tools, when the user wants to
18
group several smaller items into one big item in order to simplify
19
moving and copying of items.</p>
20
<p>If all you want is to store items inside other items, you can
21
use any <a href="qgraphicsitem.html">QGraphicsItem</a> directly by
22
passing a suitable parent to <a href="qgraphicsitem.html#setParentItem">setParentItem</a>().</p>
23
<p>The <a href="qgraphicsitemgroup.html#boundingRect">boundingRect</a>() function
24
of QGraphicsItemGroup returns the bounding rectangle of all items
25
in the item group. QGraphicsItemGroup ignores the <a href="qgraphicsitem.html#GraphicsItemFlag-enum">ItemIgnoresTransformations</a>
26
flag on its children (i.e., with respect to the geometry of the
27
group item, the children are treated as if they were
29
<p>There are two ways to construct an item group. The easiest and
30
most common approach is to pass a list of items (e.g., all selected
31
items) to <a href="qgraphicsscene.html#createItemGroup">QGraphicsScene.createItemGroup</a>(),
32
which returns a new QGraphicsItemGroup item. The other approach is
33
to manually construct a QGraphicsItemGroup item, add it to the
34
scene calling <a href="qgraphicsscene.html#addItem">QGraphicsScene.addItem</a>(), and
35
then add items to the group manually, one at a time by calling
36
<a href="qgraphicsitemgroup.html#addToGroup">addToGroup</a>(). To
37
dismantle ("ungroup") an item group, you can either call <a href="qgraphicsscene.html#destroyItemGroup">QGraphicsScene.destroyItemGroup</a>(),
38
or you can manually remove all items from the group by calling
39
<a href="qgraphicsitemgroup.html#removeFromGroup">removeFromGroup</a>().</p>
40
<pre class="highlightedCode brush: cpp">
41
<span class="comment"> // Group all selected items together</span>
16
42
QGraphicsItemGroup *group = scene->createItemGroup(scene->selecteditems());
18
44
<span class="comment"> // Destroy the group, and delete the group item</span>
19
scene->destroyItemGroup(group);</pre>
20
<p>The operation of adding and removing items preserves the items' scene-relative position and transformation, as opposed to calling <a href="qgraphicsitem.html#setParentItem">setParentItem</a>(), where only the child item's parent-relative position and transformation are kept.</p>
21
<p>The addtoGroup() function reparents the target item to this item group, keeping the item's position and transformation intact relative to the scene. Visually, this means that items added via <a href="qgraphicsitemgroup.html#addToGroup">addToGroup</a>() will remain completely unchanged as a result of this operation, regardless of the item or the group's current position or transformation; although the item's position and matrix are likely to change.</p>
22
<p>The <a href="qgraphicsitemgroup.html#removeFromGroup">removeFromGroup</a>() function has similar semantics to <a href="qgraphicsitem.html#setParentItem">setParentItem</a>(); it reparents the item to the parent item of the item group. As with <a href="qgraphicsitemgroup.html#addToGroup">addToGroup</a>(), the item's scene-relative position and transformation remain intact.</p>
23
<p>See also <a href="qgraphicsitem.html">QGraphicsItem</a> and <a href="graphicsview.html">The Graphics View Framework</a>.</p>
24
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QGraphicsItemGroup" />QGraphicsItemGroup.__init__ (<i>self</i>, <a href="qgraphicsitem.html">QGraphicsItem</a> <i>parent</i> = None, <a href="qgraphicsscene.html">QGraphicsScene</a> <i>scene</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>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="qgraphicsitemgroup.html">QGraphicsItemGroup</a>. <i>parent</i> is passed to <a href="qgraphicsitem.html">QGraphicsItem</a>'s constructor.</p>
45
scene->destroyItemGroup(group);
47
<p>The operation of adding and removing items preserves the items'
48
scene-relative position and transformation, as opposed to calling
49
<a href="qgraphicsitem.html#setParentItem">setParentItem</a>(),
50
where only the child item's parent-relative position and
51
transformation are kept.</p>
52
<p>The addtoGroup() function reparents the target item to this item
53
group, keeping the item's position and transformation intact
54
relative to the scene. Visually, this means that items added via
55
<a href="qgraphicsitemgroup.html#addToGroup">addToGroup</a>() will
56
remain completely unchanged as a result of this operation,
57
regardless of the item or the group's current position or
58
transformation; although the item's position and matrix are likely
60
<p>The <a href="qgraphicsitemgroup.html#removeFromGroup">removeFromGroup</a>()
61
function has similar semantics to <a href="qgraphicsitem.html#setParentItem">setParentItem</a>(); it
62
reparents the item to the parent item of the item group. As with
63
<a href="qgraphicsitemgroup.html#addToGroup">addToGroup</a>(), the
64
item's scene-relative position and transformation remain
66
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QGraphicsItemGroup" />QGraphicsItemGroup.__init__ (<i>self</i>, <a href="qgraphicsitem.html">QGraphicsItem</a> <i>parent</i> = None, <a href="qgraphicsscene.html">QGraphicsScene</a> <i>scene</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>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="qgraphicsitemgroup.html">QGraphicsItemGroup</a>. <i>parent</i> is
67
passed to <a href="qgraphicsitem.html">QGraphicsItem</a>'s
25
69
<p>See also <a href="qgraphicsscene.html#addItem">QGraphicsScene.addItem</a>().</p>
26
<a name="//apple_ref/cpp/instm/QGraphicsItemGroup/~QGraphicsItemGroup" />
27
<h3 class="fn"><a name="addToGroup" />QGraphicsItemGroup.addToGroup (<i>self</i>, <a href="qgraphicsitem.html">QGraphicsItem</a>)</h3><p>The <i>QGraphicsItem</i> argument has it's ownership transferred to Qt.</p><p>Adds the given <i>item</i> to this item group. The item will be reparented to this group, but its position and transformation relative to the scene will stay intact.</p>
28
<p>See also <a href="qgraphicsitemgroup.html#removeFromGroup">removeFromGroup</a>() and <a href="qgraphicsscene.html#createItemGroup">QGraphicsScene.createItemGroup</a>().</p>
29
<a name="//apple_ref/cpp/instm/QGraphicsItemGroup/boundingRect" />
72
<h3 class="fn"><a name="addToGroup" />QGraphicsItemGroup.addToGroup (<i>self</i>, <a href="qgraphicsitem.html">QGraphicsItem</a>)</h3><p>The <i>QGraphicsItem</i> argument has it's ownership transferred to Qt.</p><p>Adds the given <i>item</i> to this item group. The item will be
73
reparented to this group, but its position and transformation
74
relative to the scene will stay intact.</p>
75
<p>See also <a href="qgraphicsitemgroup.html#removeFromGroup">removeFromGroup</a>() and
76
<a href="qgraphicsscene.html#createItemGroup">QGraphicsScene.createItemGroup</a>().</p>
30
79
<h3 class="fn"><a name="boundingRect" /><a href="qrectf.html">QRectF</a> QGraphicsItemGroup.boundingRect (<i>self</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#boundingRect">QGraphicsItem.boundingRect</a>().</p>
31
<p>Returns the bounding rect of this group item, and all its children.</p>
32
<a name="//apple_ref/cpp/instm/QGraphicsItemGroup/isObscuredBy" />
80
<p>Returns the bounding rect of this group item, and all its
33
84
<h3 class="fn"><a name="isObscuredBy" />bool QGraphicsItemGroup.isObscuredBy (<i>self</i>, <a href="qgraphicsitem.html">QGraphicsItem</a>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#isObscuredBy">QGraphicsItem.isObscuredBy</a>().</p>
34
<a name="//apple_ref/cpp/instm/QGraphicsItemGroup/opaqueArea" />
35
87
<h3 class="fn"><a name="opaqueArea" /><a href="qpainterpath.html">QPainterPath</a> QGraphicsItemGroup.opaqueArea (<i>self</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#opaqueArea">QGraphicsItem.opaqueArea</a>().</p>
36
<a name="//apple_ref/cpp/instm/QGraphicsItemGroup/paint" />
37
90
<h3 class="fn"><a name="paint" />QGraphicsItemGroup.paint (<i>self</i>, <a href="qpainter.html">QPainter</a>, <a href="qstyleoptiongraphicsitem.html">QStyleOptionGraphicsItem</a>, <a href="qwidget.html">QWidget</a> <i>widget</i> = None)</h3><p>Reimplemented from <a href="qgraphicsitem.html#paint">QGraphicsItem.paint</a>().</p>
38
<a name="//apple_ref/cpp/instm/QGraphicsItemGroup/removeFromGroup" />
39
<h3 class="fn"><a name="removeFromGroup" />QGraphicsItemGroup.removeFromGroup (<i>self</i>, <a href="qgraphicsitem.html">QGraphicsItem</a>)</h3><p>Removes the specified <i>item</i> from this group. The item will be reparented to this group's parent item, or to 0 if this group has no parent. Its position and transformation relative to the scene will stay intact.</p>
93
<h3 class="fn"><a name="removeFromGroup" />QGraphicsItemGroup.removeFromGroup (<i>self</i>, <a href="qgraphicsitem.html">QGraphicsItem</a>)</h3><p>Removes the specified <i>item</i> from this group. The item will
94
be reparented to this group's parent item, or to 0 if this group
95
has no parent. Its position and transformation relative to the
96
scene will stay intact.</p>
40
97
<p>See also <a href="qgraphicsitemgroup.html#addToGroup">addToGroup</a>() and <a href="qgraphicsscene.html#destroyItemGroup">QGraphicsScene.destroyItemGroup</a>().</p>
41
<a name="//apple_ref/cpp/instm/QGraphicsItemGroup/type" />
42
100
<h3 class="fn"><a name="type" />int QGraphicsItemGroup.type (<i>self</i>)</h3><p>Reimplemented from <a href="qgraphicsitem.html#type">QGraphicsItem.type</a>().</p>
43
<p /><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'
101
<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'