<?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>QGraphicsLayoutItem 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="index.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">QGraphicsLayoutItem Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QGraphicsLayoutItem class can be inherited to allow your custom items to be managed by layouts. <a href="#details">More...</a></p> <p>Inherited by <a href="qgraphicslayout.html">QGraphicsLayout</a> and <a href="qgraphicswidget.html">QGraphicsWidget</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qgraphicslayoutitem.html#QGraphicsLayoutItem">__init__</a></b> (<i>self</i>, QGraphicsLayoutItem <i>parent</i> = None, bool <i>isLayout</i> = False)</li><li><div class="fn" />QRectF <b><a href="qgraphicslayoutitem.html#contentsRect">contentsRect</a></b> (<i>self</i>)</li><li><div class="fn" />QSizeF <b><a href="qgraphicslayoutitem.html#effectiveSizeHint">effectiveSizeHint</a></b> (<i>self</i>, Qt.SizeHint <i>which</i>, QSizeF <i>constraint</i> = QSizeF())</li><li><div class="fn" />QRectF <b><a href="qgraphicslayoutitem.html#geometry">geometry</a></b> (<i>self</i>)</li><li><div class="fn" />(float <i>left</i>, float <i>top</i>, float <i>right</i>, float <i>bottom</i>) <b><a href="qgraphicslayoutitem.html#getContentsMargins">getContentsMargins</a></b> (<i>self</i>)</li><li><div class="fn" />QGraphicsItem <b><a href="qgraphicslayoutitem.html#graphicsItem">graphicsItem</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qgraphicslayoutitem.html#isLayout">isLayout</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qgraphicslayoutitem.html#maximumHeight">maximumHeight</a></b> (<i>self</i>)</li><li><div class="fn" />QSizeF <b><a href="qgraphicslayoutitem.html#maximumSize">maximumSize</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qgraphicslayoutitem.html#maximumWidth">maximumWidth</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qgraphicslayoutitem.html#minimumHeight">minimumHeight</a></b> (<i>self</i>)</li><li><div class="fn" />QSizeF <b><a href="qgraphicslayoutitem.html#minimumSize">minimumSize</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qgraphicslayoutitem.html#minimumWidth">minimumWidth</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qgraphicslayoutitem.html#ownedByLayout">ownedByLayout</a></b> (<i>self</i>)</li><li><div class="fn" />QGraphicsLayoutItem <b><a href="qgraphicslayoutitem.html#parentLayoutItem">parentLayoutItem</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qgraphicslayoutitem.html#preferredHeight">preferredHeight</a></b> (<i>self</i>)</li><li><div class="fn" />QSizeF <b><a href="qgraphicslayoutitem.html#preferredSize">preferredSize</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qgraphicslayoutitem.html#preferredWidth">preferredWidth</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qgraphicslayoutitem.html#setGeometry">setGeometry</a></b> (<i>self</i>, QRectF <i>rect</i>)</li><li><div class="fn" /><b><a href="qgraphicslayoutitem.html#setGraphicsItem">setGraphicsItem</a></b> (<i>self</i>, QGraphicsItem <i>item</i>)</li><li><div class="fn" /><b><a href="qgraphicslayoutitem.html#setMaximumHeight">setMaximumHeight</a></b> (<i>self</i>, float <i>height</i>)</li><li><div class="fn" /><b><a href="qgraphicslayoutitem.html#setMaximumSize">setMaximumSize</a></b> (<i>self</i>, QSizeF <i>size</i>)</li><li><div class="fn" /><b><a href="qgraphicslayoutitem.html#setMaximumSize-2">setMaximumSize</a></b> (<i>self</i>, float <i>aw</i>, float <i>ah</i>)</li><li><div class="fn" /><b><a href="qgraphicslayoutitem.html#setMaximumWidth">setMaximumWidth</a></b> (<i>self</i>, float <i>width</i>)</li><li><div class="fn" /><b><a href="qgraphicslayoutitem.html#setMinimumHeight">setMinimumHeight</a></b> (<i>self</i>, float <i>height</i>)</li><li><div class="fn" /><b><a href="qgraphicslayoutitem.html#setMinimumSize">setMinimumSize</a></b> (<i>self</i>, QSizeF <i>size</i>)</li><li><div class="fn" /><b><a href="qgraphicslayoutitem.html#setMinimumSize-2">setMinimumSize</a></b> (<i>self</i>, float <i>aw</i>, float <i>ah</i>)</li><li><div class="fn" /><b><a href="qgraphicslayoutitem.html#setMinimumWidth">setMinimumWidth</a></b> (<i>self</i>, float <i>width</i>)</li><li><div class="fn" /><b><a href="qgraphicslayoutitem.html#setOwnedByLayout">setOwnedByLayout</a></b> (<i>self</i>, bool <i>ownedByLayout</i>)</li><li><div class="fn" /><b><a href="qgraphicslayoutitem.html#setParentLayoutItem">setParentLayoutItem</a></b> (<i>self</i>, QGraphicsLayoutItem <i>parent</i>)</li><li><div class="fn" /><b><a href="qgraphicslayoutitem.html#setPreferredHeight">setPreferredHeight</a></b> (<i>self</i>, float <i>height</i>)</li><li><div class="fn" /><b><a href="qgraphicslayoutitem.html#setPreferredSize">setPreferredSize</a></b> (<i>self</i>, QSizeF <i>size</i>)</li><li><div class="fn" /><b><a href="qgraphicslayoutitem.html#setPreferredSize-2">setPreferredSize</a></b> (<i>self</i>, float <i>aw</i>, float <i>ah</i>)</li><li><div class="fn" /><b><a href="qgraphicslayoutitem.html#setPreferredWidth">setPreferredWidth</a></b> (<i>self</i>, float <i>width</i>)</li><li><div class="fn" /><b><a href="qgraphicslayoutitem.html#setSizePolicy">setSizePolicy</a></b> (<i>self</i>, QSizePolicy <i>policy</i>)</li><li><div class="fn" /><b><a href="qgraphicslayoutitem.html#setSizePolicy-2">setSizePolicy</a></b> (<i>self</i>, QSizePolicy.Policy <i>hPolicy</i>, QSizePolicy.Policy <i>vPolicy</i>, QSizePolicy.ControlType <i>controlType</i> = QSizePolicy.DefaultType)</li><li><div class="fn" />QSizeF <b><a href="qgraphicslayoutitem.html#sizeHint">sizeHint</a></b> (<i>self</i>, Qt.SizeHint <i>which</i>, QSizeF <i>constraint</i> = QSizeF())</li><li><div class="fn" />QSizePolicy <b><a href="qgraphicslayoutitem.html#sizePolicy">sizePolicy</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qgraphicslayoutitem.html#updateGeometry">updateGeometry</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QGraphicsLayoutItem class can be inherited to allow your custom items to be managed by layouts.</p> <p>QGraphicsLayoutItem is an abstract class that defines a set of virtual functions describing sizes, size policies, and size hints for any object arranged by <a href="qgraphicslayout.html">QGraphicsLayout</a>. The API contains functions relevant for both the item itself and for the user of the item as most of QGraphicsLayoutItem's functions are also part of the subclass' public API.</p> <p>In most cases, existing layout-aware classes such as <a href="qgraphicswidget.html">QGraphicsWidget</a> and <a href="qgraphicslayout.html">QGraphicsLayout</a> already provide the functionality you require. However, subclassing these classes will enable you to create both graphical elements that work well with layouts (<a href="qgraphicswidget.html">QGraphicsWidget</a>) or custom layouts (<a href="qgraphicslayout.html">QGraphicsLayout</a>).</p> <a id="subclassing-qgraphicslayoutitem" name="subclassing-qgraphicslayoutitem" /> <h3>Subclassing QGraphicsLayoutItem</h3> <p>If you create a subclass of QGraphicsLayoutItem and reimplement its virtual functions, you will enable the layout to resize and position your item along with other QGraphicsLayoutItems including <a href="qgraphicswidget.html">QGraphicsWidget</a> and <a href="qgraphicslayout.html">QGraphicsLayout</a>.</p> <p>You can start by reimplementing important functions: the protected <a href="qgraphicslayoutitem.html#sizeHint">sizeHint</a>() function, as well as the public <a href="qgraphicslayoutitem.html#setGeometry">setGeometry</a>() function. If you want your items to be aware of immediate geometry changes, you can also reimplement <a href="qgraphicslayoutitem.html#updateGeometry">updateGeometry</a>().</p> <p>The geometry, size hint, and size policy affect the item's size and position. Calling <a href="qgraphicslayoutitem.html#setGeometry">setGeometry</a>() will always resize and reposition the item immediately. Normally, this function is called by <a href="qgraphicslayout.html">QGraphicsLayout</a> after the layout has been activated, but it can also be called by the item's user at any time.</p> <p>The <a href="qgraphicslayoutitem.html#sizeHint">sizeHint</a>() function returns the item' minimum, preferred and maximum size hints. You can override these properties by calling <a href="qgraphicslayoutitem.html#setMinimumSize">setMinimumSize</a>(), <a href="qgraphicslayoutitem.html#setPreferredSize">setPreferredSize</a>() or <a href="qgraphicslayoutitem.html#setMaximumSize">setMaximumSize</a>(). You can also use functions such as <a href="qgraphicslayoutitem.html#setMinimumWidth">setMinimumWidth</a>() or <a href="qgraphicslayoutitem.html#setMaximumHeight">setMaximumHeight</a>() to set only the width or height component if desired.</p> <p>The <a href="qgraphicslayoutitem.html#effectiveSizeHint">effectiveSizeHint</a>() function, on the other hand, returns a size hint for any given <a href="qt.html#SizeHint-enum">Qt.SizeHint</a>, and guarantees that the returned size is bound to the minimum and maximum sizes and size hints. You can set the item's vertical and horizontal size policy by calling <a href="qgraphicslayoutitem.html#setSizePolicy">setSizePolicy</a>(). The sizePolicy property is used by the layout system to describe how this item prefers to grow or shrink.</p> <a id="nesting-qgraphicslayoutitems" name="nesting-qgraphicslayoutitems" /> <h3>Nesting QGraphicsLayoutItems</h3> <p>QGraphicsLayoutItems can be nested within other QGraphicsLayoutItems, similar to layouts that can contain sublayouts. This is done either by passing a QGraphicsLayoutItem pointer to QGraphicsLayoutItem's protected constructor, or by calling <a href="qgraphicslayoutitem.html#setParentLayoutItem">setParentLayoutItem</a>(). The <a href="qgraphicslayoutitem.html#parentLayoutItem">parentLayoutItem</a>() function returns a pointer to the item's layoutItem parent. If the item's parent is 0 or if the parent does not inherit from <a href="qgraphicsitem.html">QGraphicsItem</a>, the <a href="qgraphicslayoutitem.html#parentLayoutItem">parentLayoutItem</a>() function then returns 0. <a href="qgraphicslayoutitem.html#isLayout">isLayout</a>() returns true if the QGraphicsLayoutItem subclass is itself a layout, or false otherwise.</p> <p>Qt uses QGraphicsLayoutItem to provide layout functionality in the <a href="graphicsview.html">Graphics View Framework</a>, but in the future its use may spread throughout Qt itself.</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QGraphicsLayoutItem" />QGraphicsLayoutItem.__init__ (<i>self</i>, <a href="qgraphicslayoutitem.html">QGraphicsLayoutItem</a> <i>parent</i> = None, bool <i>isLayout</i> = False)</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 the <a href="qgraphicslayoutitem.html">QGraphicsLayoutItem</a> object. <i>parent</i> becomes the object's parent. If <i>isLayout</i> is true the item is a layout, otherwise <i>isLayout</i> is false.</p> <h3 class="fn"><a name="contentsRect" /><a href="qrectf.html">QRectF</a> QGraphicsLayoutItem.contentsRect (<i>self</i>)</h3><p>Returns the contents rect in local coordinates.</p> <p>The contents rect defines the subrectangle used by an associated layout when arranging subitems. This function is a convenience function that adjusts the item's <a href="qgraphicslayoutitem.html#geometry">geometry</a>() by its contents margins. Note that <a href="qgraphicslayoutitem.html#getContentsMargins">getContentsMargins</a>() is a virtual function that you can reimplement to return the item's contents margins.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#getContentsMargins">getContentsMargins</a>() and <a href="qgraphicslayoutitem.html#geometry">geometry</a>().</p> <h3 class="fn"><a name="effectiveSizeHint" /><a href="qsizef.html">QSizeF</a> QGraphicsLayoutItem.effectiveSizeHint (<i>self</i>, <a href="qt.html#SizeHint-enum">Qt.SizeHint</a> <i>which</i>, <a href="qsizef.html">QSizeF</a> <i>constraint</i> = QSizeF())</h3><p>Returns the effective size hint for this <a href="qgraphicslayoutitem.html">QGraphicsLayoutItem</a>.</p> <p><i>which</i> is the size hint in question. <i>constraint</i> is an optional argument that defines a special constrain when calculating the effective size hint. By default, <i>constraint</i> is <a href="qsizef.html">QSizeF</a>(-1, -1), which means there is no constraint to the size hint.</p> <p>If you want to specify the widget's size hint for a given width or height, you can provide the fixed dimension in <i>constraint</i>. This is useful for widgets that can grow only either vertically or horizontally, and need to set either their width or their height to a special value.</p> <p>For example, a text paragraph item fit into a column width of 200 may grow vertically. You can pass <a href="qsizef.html">QSizeF</a>(200, -1) as a constraint to get a suitable minimum, preferred and maximum height).</p> <p>You can adjust the effective size hint by reimplementing <a href="qgraphicslayoutitem.html#sizeHint">sizeHint</a>() in a <a href="qgraphicslayoutitem.html">QGraphicsLayoutItem</a> subclass, or by calling one of the following functions: <a href="qgraphicslayoutitem.html#setMinimumSize">setMinimumSize</a>(), setPreferredSize, or <a href="qgraphicslayoutitem.html#setMaximumSize">setMaximumSize</a>() (or a combination of both).</p> <p>This function caches each of the size hints and guarantees that <a href="qgraphicslayoutitem.html#sizeHint">sizeHint</a>() will be called only once for each value of <i>which</i> - unless <i>constraint</i> is not specified and <a href="qgraphicslayoutitem.html#updateGeometry">updateGeometry</a>() has been called.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#sizeHint">sizeHint</a>().</p> <h3 class="fn"><a name="geometry" /><a href="qrectf.html">QRectF</a> QGraphicsLayoutItem.geometry (<i>self</i>)</h3><p>Returns the item's geometry (e.g., position and size) as a <a href="qrectf.html">QRectF</a>. This function is equivalent to <a href="qrectf.html">QRectF</a>(pos(), size()).</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#setGeometry">setGeometry</a>().</p> <h3 class="fn"><a name="getContentsMargins" />(float <i>left</i>, float <i>top</i>, float <i>right</i>, float <i>bottom</i>) QGraphicsLayoutItem.getContentsMargins (<i>self</i>)</h3><p>This virtual function provides the <i>left</i>, <i>top</i>, <i>right</i> and <i>bottom</i> contents margins for this <a href="qgraphicslayoutitem.html">QGraphicsLayoutItem</a>. The default implementation assumes all contents margins are 0. The parameters point to values stored in qreals. If any of the pointers is 0, that value will not be updated.</p> <p><b>See also</b> <a href="qgraphicswidget.html#setContentsMargins">QGraphicsWidget.setContentsMargins</a>().</p> <h3 class="fn"><a name="graphicsItem" /><a href="qgraphicsitem.html">QGraphicsItem</a> QGraphicsLayoutItem.graphicsItem (<i>self</i>)</h3><p>Returns the <a href="qgraphicsitem.html">QGraphicsItem</a> that this layout item represents. For <a href="qgraphicswidget.html">QGraphicsWidget</a> it will return itself. For custom items it can return an aggregated value.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#setGraphicsItem">setGraphicsItem</a>().</p> <h3 class="fn"><a name="isLayout" />bool QGraphicsLayoutItem.isLayout (<i>self</i>)</h3><p>Returns true if this <a href="qgraphicslayoutitem.html">QGraphicsLayoutItem</a> is a layout (e.g., is inherited by an object that arranges other <a href="qgraphicslayoutitem.html">QGraphicsLayoutItem</a> objects); otherwise returns false.</p> <p><b>See also</b> <a href="qgraphicslayout.html">QGraphicsLayout</a>.</p> <h3 class="fn"><a name="maximumHeight" />float QGraphicsLayoutItem.maximumHeight (<i>self</i>)</h3><p>Returns the maximum height.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#setMaximumHeight">setMaximumHeight</a>(), <a href="qgraphicslayoutitem.html#setMaximumSize">setMaximumSize</a>(), and <a href="qgraphicslayoutitem.html#maximumSize">maximumSize</a>().</p> <h3 class="fn"><a name="maximumSize" /><a href="qsizef.html">QSizeF</a> QGraphicsLayoutItem.maximumSize (<i>self</i>)</h3><p>Returns the maximum size.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#setMaximumSize">setMaximumSize</a>(), <a href="qgraphicslayoutitem.html#minimumSize">minimumSize</a>(), <a href="qgraphicslayoutitem.html#preferredSize">preferredSize</a>(), <a href="qt.html#SizeHint-enum">Qt.MaximumSize</a>, and <a href="qgraphicslayoutitem.html#sizeHint">sizeHint</a>().</p> <h3 class="fn"><a name="maximumWidth" />float QGraphicsLayoutItem.maximumWidth (<i>self</i>)</h3><p>Returns the maximum width.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#setMaximumWidth">setMaximumWidth</a>(), <a href="qgraphicslayoutitem.html#setMaximumSize">setMaximumSize</a>(), and <a href="qgraphicslayoutitem.html#maximumSize">maximumSize</a>().</p> <h3 class="fn"><a name="minimumHeight" />float QGraphicsLayoutItem.minimumHeight (<i>self</i>)</h3><p>Returns the minimum height.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#setMinimumHeight">setMinimumHeight</a>(), <a href="qgraphicslayoutitem.html#setMinimumSize">setMinimumSize</a>(), and <a href="qgraphicslayoutitem.html#minimumSize">minimumSize</a>().</p> <h3 class="fn"><a name="minimumSize" /><a href="qsizef.html">QSizeF</a> QGraphicsLayoutItem.minimumSize (<i>self</i>)</h3><p>Returns the minimum size.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#setMinimumSize">setMinimumSize</a>(), <a href="qgraphicslayoutitem.html#preferredSize">preferredSize</a>(), <a href="qgraphicslayoutitem.html#maximumSize">maximumSize</a>(), <a href="qt.html#SizeHint-enum">Qt.MinimumSize</a>, and <a href="qgraphicslayoutitem.html#sizeHint">sizeHint</a>().</p> <h3 class="fn"><a name="minimumWidth" />float QGraphicsLayoutItem.minimumWidth (<i>self</i>)</h3><p>Returns the minimum width.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#setMinimumWidth">setMinimumWidth</a>(), <a href="qgraphicslayoutitem.html#setMinimumSize">setMinimumSize</a>(), and <a href="qgraphicslayoutitem.html#minimumSize">minimumSize</a>().</p> <h3 class="fn"><a name="ownedByLayout" />bool QGraphicsLayoutItem.ownedByLayout (<i>self</i>)</h3><p>Returns whether a layout should delete this item in its destructor. If its true, then the layout will delete it. If its false, then it is assumed that another object has the ownership of it, and the layout won't delete this item.</p> <p>If the item inherits both <a href="qgraphicsitem.html">QGraphicsItem</a> and <a href="qgraphicslayoutitem.html">QGraphicsLayoutItem</a> (such as <a href="qgraphicswidget.html">QGraphicsWidget</a> does) the item is really part of two ownership hierarchies. This property informs what the layout should do with its child items when it is destructed. In the case of <a href="qgraphicswidget.html">QGraphicsWidget</a>, it is preferred that when the layout is deleted it won't delete its children (since they are also part of the graphics item hierarchy).</p> <p>By default this value is initialized to false in <a href="qgraphicslayoutitem.html">QGraphicsLayoutItem</a>, but it is overridden by <a href="qgraphicslayout.html">QGraphicsLayout</a> to return true. This is because <a href="qgraphicslayout.html">QGraphicsLayout</a> is not normally part of the <a href="qgraphicsitem.html">QGraphicsItem</a> hierarchy, so the parent layout should delete it. Subclasses might override this default behaviour by calling setOwnedByLayout(true).</p> <p>This function was introduced in Qt 4.6.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#setOwnedByLayout">setOwnedByLayout</a>().</p> <h3 class="fn"><a name="parentLayoutItem" /><a href="qgraphicslayoutitem.html">QGraphicsLayoutItem</a> QGraphicsLayoutItem.parentLayoutItem (<i>self</i>)</h3><p>Returns the parent of this <a href="qgraphicslayoutitem.html">QGraphicsLayoutItem</a>, or 0 if there is no parent, or if the parent does not inherit from <a href="qgraphicslayoutitem.html">QGraphicsLayoutItem</a> (<a href="qgraphicslayoutitem.html">QGraphicsLayoutItem</a> is often used through multiple inheritance with <a href="qobject.html">QObject</a>-derived classes).</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#setParentLayoutItem">setParentLayoutItem</a>().</p> <h3 class="fn"><a name="preferredHeight" />float QGraphicsLayoutItem.preferredHeight (<i>self</i>)</h3><p>Returns the preferred height.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#setPreferredHeight">setPreferredHeight</a>(), <a href="qgraphicslayoutitem.html#setPreferredSize">setPreferredSize</a>(), and <a href="qgraphicslayoutitem.html#preferredSize">preferredSize</a>().</p> <h3 class="fn"><a name="preferredSize" /><a href="qsizef.html">QSizeF</a> QGraphicsLayoutItem.preferredSize (<i>self</i>)</h3><p>Returns the preferred size.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#setPreferredSize">setPreferredSize</a>(), <a href="qgraphicslayoutitem.html#minimumSize">minimumSize</a>(), <a href="qgraphicslayoutitem.html#maximumSize">maximumSize</a>(), <a href="qt.html#SizeHint-enum">Qt.PreferredSize</a>, and <a href="qgraphicslayoutitem.html#sizeHint">sizeHint</a>().</p> <h3 class="fn"><a name="preferredWidth" />float QGraphicsLayoutItem.preferredWidth (<i>self</i>)</h3><p>Returns the preferred width.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#setPreferredWidth">setPreferredWidth</a>(), <a href="qgraphicslayoutitem.html#setPreferredSize">setPreferredSize</a>(), and <a href="qgraphicslayoutitem.html#preferredSize">preferredSize</a>().</p> <h3 class="fn"><a name="setGeometry" />QGraphicsLayoutItem.setGeometry (<i>self</i>, <a href="qrectf.html">QRectF</a> <i>rect</i>)</h3><p>This virtual function sets the geometry of the <a href="qgraphicslayoutitem.html">QGraphicsLayoutItem</a> to <i>rect</i>, which is in parent coordinates (e.g., the top-left corner of <i>rect</i> is equivalent to the item's position in parent coordinates).</p> <p>You must reimplement this function in a subclass of <a href="qgraphicslayoutitem.html">QGraphicsLayoutItem</a> to receive geometry updates. The layout will call this function when it does a rearrangement.</p> <p>If <i>rect</i> is outside of the bounds of minimumSize and maximumSize, it will be adjusted to its closest size so that it is within the legal bounds.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#geometry">geometry</a>().</p> <h3 class="fn"><a name="setGraphicsItem" />QGraphicsLayoutItem.setGraphicsItem (<i>self</i>, <a href="qgraphicsitem.html">QGraphicsItem</a> <i>item</i>)</h3><p>If the <a href="qgraphicslayoutitem.html">QGraphicsLayoutItem</a> represents a <a href="qgraphicsitem.html">QGraphicsItem</a>, and it wants to take advantage of the automatic reparenting capabilities of <a href="qgraphicslayout.html">QGraphicsLayout</a> it should set this value. Note that if you delete <i>item</i> and not delete the layout item, you are responsible of calling setGraphicsItem(0) in order to avoid having a dangling pointer.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#graphicsItem">graphicsItem</a>().</p> <h3 class="fn"><a name="setMaximumHeight" />QGraphicsLayoutItem.setMaximumHeight (<i>self</i>, float <i>height</i>)</h3><p>Sets the maximum height to <i>height</i>.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#maximumHeight">maximumHeight</a>(), <a href="qgraphicslayoutitem.html#setMaximumSize">setMaximumSize</a>(), and <a href="qgraphicslayoutitem.html#maximumSize">maximumSize</a>().</p> <h3 class="fn"><a name="setMaximumSize" />QGraphicsLayoutItem.setMaximumSize (<i>self</i>, <a href="qsizef.html">QSizeF</a> <i>size</i>)</h3><p>Sets the maximum size to <i>size</i>. This property overrides <a href="qgraphicslayoutitem.html#sizeHint">sizeHint</a>() for <a href="qt.html#SizeHint-enum">Qt.MaximumSize</a> and ensures that <a href="qgraphicslayoutitem.html#effectiveSizeHint">effectiveSizeHint</a>() will never return a size larger than <i>size</i>. In order to unset the maximum size, use an invalid size.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#maximumSize">maximumSize</a>(), <a href="qgraphicslayoutitem.html#minimumSize">minimumSize</a>(), <a href="qgraphicslayoutitem.html#preferredSize">preferredSize</a>(), <a href="qt.html#SizeHint-enum">Qt.MaximumSize</a>, and <a href="qgraphicslayoutitem.html#sizeHint">sizeHint</a>().</p> <h3 class="fn"><a name="setMaximumSize-2" />QGraphicsLayoutItem.setMaximumSize (<i>self</i>, float <i>aw</i>, float <i>ah</i>)</h3><p>This convenience function is equivalent to calling setMaximumSize(<a href="qsizef.html">QSizeF</a>(<i>w</i>, <i>h</i>)).</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#maximumSize">maximumSize</a>(), <a href="qgraphicslayoutitem.html#setMinimumSize">setMinimumSize</a>(), <a href="qgraphicslayoutitem.html#setPreferredSize">setPreferredSize</a>(), and <a href="qgraphicslayoutitem.html#sizeHint">sizeHint</a>().</p> <h3 class="fn"><a name="setMaximumWidth" />QGraphicsLayoutItem.setMaximumWidth (<i>self</i>, float <i>width</i>)</h3><p>Sets the maximum width to <i>width</i>.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#maximumWidth">maximumWidth</a>(), <a href="qgraphicslayoutitem.html#setMaximumSize">setMaximumSize</a>(), and <a href="qgraphicslayoutitem.html#maximumSize">maximumSize</a>().</p> <h3 class="fn"><a name="setMinimumHeight" />QGraphicsLayoutItem.setMinimumHeight (<i>self</i>, float <i>height</i>)</h3><p>Sets the minimum height to <i>height</i>.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#minimumHeight">minimumHeight</a>(), <a href="qgraphicslayoutitem.html#setMinimumSize">setMinimumSize</a>(), and <a href="qgraphicslayoutitem.html#minimumSize">minimumSize</a>().</p> <h3 class="fn"><a name="setMinimumSize" />QGraphicsLayoutItem.setMinimumSize (<i>self</i>, <a href="qsizef.html">QSizeF</a> <i>size</i>)</h3><p>Sets the minimum size to <i>size</i>. This property overrides <a href="qgraphicslayoutitem.html#sizeHint">sizeHint</a>() for <a href="qt.html#SizeHint-enum">Qt.MinimumSize</a> and ensures that <a href="qgraphicslayoutitem.html#effectiveSizeHint">effectiveSizeHint</a>() will never return a size smaller than <i>size</i>. In order to unset the minimum size, use an invalid size.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#minimumSize">minimumSize</a>(), <a href="qgraphicslayoutitem.html#maximumSize">maximumSize</a>(), <a href="qgraphicslayoutitem.html#preferredSize">preferredSize</a>(), <a href="qt.html#SizeHint-enum">Qt.MinimumSize</a>, <a href="qgraphicslayoutitem.html#sizeHint">sizeHint</a>(), <a href="qgraphicslayoutitem.html#setMinimumWidth">setMinimumWidth</a>(), and <a href="qgraphicslayoutitem.html#setMinimumHeight">setMinimumHeight</a>().</p> <h3 class="fn"><a name="setMinimumSize-2" />QGraphicsLayoutItem.setMinimumSize (<i>self</i>, float <i>aw</i>, float <i>ah</i>)</h3><p>This convenience function is equivalent to calling setMinimumSize(<a href="qsizef.html">QSizeF</a>(<i>w</i>, <i>h</i>)).</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#minimumSize">minimumSize</a>(), <a href="qgraphicslayoutitem.html#setMaximumSize">setMaximumSize</a>(), <a href="qgraphicslayoutitem.html#setPreferredSize">setPreferredSize</a>(), and <a href="qgraphicslayoutitem.html#sizeHint">sizeHint</a>().</p> <h3 class="fn"><a name="setMinimumWidth" />QGraphicsLayoutItem.setMinimumWidth (<i>self</i>, float <i>width</i>)</h3><p>Sets the minimum width to <i>width</i>.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#minimumWidth">minimumWidth</a>(), <a href="qgraphicslayoutitem.html#setMinimumSize">setMinimumSize</a>(), and <a href="qgraphicslayoutitem.html#minimumSize">minimumSize</a>().</p> <h3 class="fn"><a name="setOwnedByLayout" />QGraphicsLayoutItem.setOwnedByLayout (<i>self</i>, bool <i>ownedByLayout</i>)</h3><p>Sets whether a layout should delete this item in its destructor or not. <i>ownership</i> must be true to in order for the layout to delete it.</p> <p>This function was introduced in Qt 4.6.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#ownedByLayout">ownedByLayout</a>().</p> <h3 class="fn"><a name="setParentLayoutItem" />QGraphicsLayoutItem.setParentLayoutItem (<i>self</i>, <a href="qgraphicslayoutitem.html">QGraphicsLayoutItem</a> <i>parent</i>)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Sets the parent of this <a href="qgraphicslayoutitem.html">QGraphicsLayoutItem</a> to <i>parent</i>.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#parentLayoutItem">parentLayoutItem</a>().</p> <h3 class="fn"><a name="setPreferredHeight" />QGraphicsLayoutItem.setPreferredHeight (<i>self</i>, float <i>height</i>)</h3><p>Sets the preferred height to <i>height</i>.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#preferredHeight">preferredHeight</a>(), <a href="qgraphicslayoutitem.html#preferredWidth">preferredWidth</a>(), <a href="qgraphicslayoutitem.html#setPreferredSize">setPreferredSize</a>(), and <a href="qgraphicslayoutitem.html#preferredSize">preferredSize</a>().</p> <h3 class="fn"><a name="setPreferredSize" />QGraphicsLayoutItem.setPreferredSize (<i>self</i>, <a href="qsizef.html">QSizeF</a> <i>size</i>)</h3><p>Sets the preferred size to <i>size</i>. This property overrides <a href="qgraphicslayoutitem.html#sizeHint">sizeHint</a>() for <a href="qt.html#SizeHint-enum">Qt.PreferredSize</a> and provides the default value for <a href="qgraphicslayoutitem.html#effectiveSizeHint">effectiveSizeHint</a>(). In order to unset the preferred size, use an invalid size.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#preferredSize">preferredSize</a>(), <a href="qgraphicslayoutitem.html#minimumSize">minimumSize</a>(), <a href="qgraphicslayoutitem.html#maximumSize">maximumSize</a>(), <a href="qt.html#SizeHint-enum">Qt.PreferredSize</a>, and <a href="qgraphicslayoutitem.html#sizeHint">sizeHint</a>().</p> <h3 class="fn"><a name="setPreferredSize-2" />QGraphicsLayoutItem.setPreferredSize (<i>self</i>, float <i>aw</i>, float <i>ah</i>)</h3><p>This convenience function is equivalent to calling setPreferredSize(<a href="qsizef.html">QSizeF</a>(<i>w</i>, <i>h</i>)).</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#preferredSize">preferredSize</a>(), <a href="qgraphicslayoutitem.html#setMaximumSize">setMaximumSize</a>(), <a href="qgraphicslayoutitem.html#setMinimumSize">setMinimumSize</a>(), and <a href="qgraphicslayoutitem.html#sizeHint">sizeHint</a>().</p> <h3 class="fn"><a name="setPreferredWidth" />QGraphicsLayoutItem.setPreferredWidth (<i>self</i>, float <i>width</i>)</h3><p>Sets the preferred width to <i>width</i>.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#preferredWidth">preferredWidth</a>(), <a href="qgraphicslayoutitem.html#preferredHeight">preferredHeight</a>(), <a href="qgraphicslayoutitem.html#setPreferredSize">setPreferredSize</a>(), and <a href="qgraphicslayoutitem.html#preferredSize">preferredSize</a>().</p> <h3 class="fn"><a name="setSizePolicy" />QGraphicsLayoutItem.setSizePolicy (<i>self</i>, <a href="qsizepolicy.html">QSizePolicy</a> <i>policy</i>)</h3><p>Sets the size policy to <i>policy</i>. The size policy describes how the item should grow horizontally and vertically when arranged in a layout.</p> <p><a href="qgraphicslayoutitem.html">QGraphicsLayoutItem</a>'s default size policy is (<a href="qsizepolicy.html#Policy-enum">QSizePolicy.Fixed</a>, <a href="qsizepolicy.html#Policy-enum">QSizePolicy.Fixed</a>, <a href="qsizepolicy.html#ControlType-enum">QSizePolicy.DefaultType</a>), but it is common for subclasses to change the default. For example, <a href="qgraphicswidget.html">QGraphicsWidget</a> defaults to (<a href="qsizepolicy.html#Policy-enum">QSizePolicy.Preferred</a>, <a href="qsizepolicy.html#Policy-enum">QSizePolicy.Preferred</a>, <a href="qsizepolicy.html#ControlType-enum">QSizePolicy.DefaultType</a>).</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#sizePolicy">sizePolicy</a>() and <a href="qwidget.html#sizePolicy-prop">QWidget.sizePolicy</a>().</p> <h3 class="fn"><a name="setSizePolicy-2" />QGraphicsLayoutItem.setSizePolicy (<i>self</i>, <a href="qsizepolicy.html#Policy-enum">QSizePolicy.Policy</a> <i>hPolicy</i>, <a href="qsizepolicy.html#Policy-enum">QSizePolicy.Policy</a> <i>vPolicy</i>, <a href="qsizepolicy.html#ControlType-enum">QSizePolicy.ControlType</a> <i>controlType</i> = QSizePolicy.DefaultType)</h3><p>This is an overloaded function.</p> <p>This function is equivalent to calling setSizePolicy(<a href="qsizepolicy.html">QSizePolicy</a>(<i>hPolicy</i>, <i>vPolicy</i>, <i>controlType</i>)).</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#sizePolicy">sizePolicy</a>() and <a href="qwidget.html#sizePolicy-prop">QWidget.sizePolicy</a>().</p> <h3 class="fn"><a name="sizeHint" /><a href="qsizef.html">QSizeF</a> QGraphicsLayoutItem.sizeHint (<i>self</i>, <a href="qt.html#SizeHint-enum">Qt.SizeHint</a> <i>which</i>, <a href="qsizef.html">QSizeF</a> <i>constraint</i> = QSizeF())</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>This pure virtual function returns the size hint for <i>which</i> of the <a href="qgraphicslayoutitem.html">QGraphicsLayoutItem</a>, using the width or height of <i>constraint</i> to constrain the output.</p> <p>Reimplement this function in a subclass of <a href="qgraphicslayoutitem.html">QGraphicsLayoutItem</a> to provide the necessary size hints for your items.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#effectiveSizeHint">effectiveSizeHint</a>().</p> <h3 class="fn"><a name="sizePolicy" /><a href="qsizepolicy.html">QSizePolicy</a> QGraphicsLayoutItem.sizePolicy (<i>self</i>)</h3><p>Returns the current size policy.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#setSizePolicy">setSizePolicy</a>() and <a href="qwidget.html#sizePolicy-prop">QWidget.sizePolicy</a>().</p> <h3 class="fn"><a name="updateGeometry" />QGraphicsLayoutItem.updateGeometry (<i>self</i>)</h3><p>This virtual function discards any cached size hint information. You should always call this function if you change the return value of the <a href="qgraphicslayoutitem.html#sizeHint">sizeHint</a>() function. Subclasses must always call the base implementation when reimplementing this function.</p> <p><b>See also</b> <a href="qgraphicslayoutitem.html#effectiveSizeHint">effectiveSizeHint</a>().</p> <address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.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> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>