File: qlayoutitem.html

package info (click to toggle)
python-qt4 4.12.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 40,300 kB
  • ctags: 6,185
  • sloc: python: 125,988; cpp: 13,291; xml: 292; makefile: 246; php: 27; sh: 2
file content (137 lines) | stat: -rw-r--r-- 13,366 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
<?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>QLayoutItem 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">QLayoutItem Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QLayoutItem class provides an abstract item that a <a href="qlayout.html">QLayout</a> manipulates. <a href="#details">More...</a></p>

<p>Inherited by <a href="qlayout.html">QLayout</a>, <a href="qspaceritem.html">QSpacerItem</a> and <a href="qwidgetitem.html">QWidgetItem</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qlayoutitem.html#QLayoutItem">__init__</a></b> (<i>self</i>, Qt.Alignment&#160;<i>alignment</i>&#160;=&#160;0)</li><li><div class="fn" /><b><a href="qlayoutitem.html#QLayoutItem-2">__init__</a></b> (<i>self</i>, QLayoutItem)</li><li><div class="fn" />Qt.Alignment <b><a href="qlayoutitem.html#alignment">alignment</a></b> (<i>self</i>)</li><li><div class="fn" />QSizePolicy.ControlTypes <b><a href="qlayoutitem.html#controlTypes">controlTypes</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.Orientations <b><a href="qlayoutitem.html#expandingDirections">expandingDirections</a></b> (<i>self</i>)</li><li><div class="fn" />QRect <b><a href="qlayoutitem.html#geometry">geometry</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qlayoutitem.html#hasHeightForWidth">hasHeightForWidth</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qlayoutitem.html#heightForWidth">heightForWidth</a></b> (<i>self</i>, int)</li><li><div class="fn" /><b><a href="qlayoutitem.html#invalidate">invalidate</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qlayoutitem.html#isEmpty">isEmpty</a></b> (<i>self</i>)</li><li><div class="fn" />QLayout <b><a href="qlayoutitem.html#layout">layout</a></b> (<i>self</i>)</li><li><div class="fn" />QSize <b><a href="qlayoutitem.html#maximumSize">maximumSize</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qlayoutitem.html#minimumHeightForWidth">minimumHeightForWidth</a></b> (<i>self</i>, int)</li><li><div class="fn" />QSize <b><a href="qlayoutitem.html#minimumSize">minimumSize</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qlayoutitem.html#setAlignment">setAlignment</a></b> (<i>self</i>, Qt.Alignment&#160;<i>a</i>)</li><li><div class="fn" /><b><a href="qlayoutitem.html#setGeometry">setGeometry</a></b> (<i>self</i>, QRect)</li><li><div class="fn" />QSize <b><a href="qlayoutitem.html#sizeHint">sizeHint</a></b> (<i>self</i>)</li><li><div class="fn" />QSpacerItem <b><a href="qlayoutitem.html#spacerItem">spacerItem</a></b> (<i>self</i>)</li><li><div class="fn" />QWidget <b><a href="qlayoutitem.html#widget">widget</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QLayoutItem class provides an abstract item that a <a href="qlayout.html">QLayout</a> manipulates.</p>
<p>This is used by custom layouts.</p>
<p>Pure virtual functions are provided to return information about
the layout, including, <a href="qlayoutitem.html#sizeHint">sizeHint</a>(), <a href="qlayoutitem.html#minimumSize">minimumSize</a>(), <a href="qlayoutitem.html#maximumSize">maximumSize</a>() and
expanding().</p>
<p>The layout's geometry can be set and retrieved with <a href="qlayoutitem.html#setGeometry">setGeometry</a>() and <a href="qlayoutitem.html#geometry">geometry</a>(), and its alignment with
<a href="qlayoutitem.html#setAlignment">setAlignment</a>() and
<a href="qlayoutitem.html#alignment">alignment</a>().</p>
<p><a href="qlayoutitem.html#isEmpty">isEmpty</a>() returns whether
the layout item is empty. If the concrete item is a <a href="qwidget.html">QWidget</a>, it can be retrieved using <a href="qlayoutitem.html#widget">widget</a>(). Similarly for <a href="qlayoutitem.html#layout">layout</a>() and <a href="qlayoutitem.html#spacerItem">spacerItem</a>().</p>
<p>Some layouts have width and height interdependencies. These can
be expressed using <a href="qlayoutitem.html#hasHeightForWidth">hasHeightForWidth</a>(),
<a href="qlayoutitem.html#heightForWidth">heightForWidth</a>(), and
<a href="qlayoutitem.html#minimumHeightForWidth">minimumHeightForWidth</a>().
For more explanation see the <i>Qt Quarterly</i> article <a href="http://doc.qt.digia.com/qq/qq04-height-for-width.html">Trading
Height for Width</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QLayoutItem" />QLayoutItem.__init__ (<i>self</i>, <a href="qt-alignment.html">Qt.Alignment</a>&#160;<i>alignment</i>&#160;=&#160;0)</h3><p>Constructs a layout item with an <i>alignment</i>. Not all
subclasses support alignment.</p>


<h3 class="fn"><a name="QLayoutItem-2" />QLayoutItem.__init__ (<i>self</i>, <a href="qlayoutitem.html">QLayoutItem</a>)</h3><h3 class="fn"><a name="alignment" /><a href="qt-alignment.html">Qt.Alignment</a> QLayoutItem.alignment (<i>self</i>)</h3><p>Returns the alignment of this item.</p>
<p><b>See also</b> <a href="qlayoutitem.html#setAlignment">setAlignment</a>().</p>


<h3 class="fn"><a name="controlTypes" /><a href="qsizepolicy-controltypes.html">QSizePolicy.ControlTypes</a> QLayoutItem.controlTypes (<i>self</i>)</h3><p>Returns the control type(s) for the layout item. For a <a href="qwidgetitem.html">QWidgetItem</a>, the control type comes from the
widget's size policy; for a <a href="qlayoutitem.html">QLayoutItem</a>, the control types is derived
from the layout's contents.</p>
<p><b>See also</b> <a href="qsizepolicy.html#controlType">QSizePolicy.controlType</a>().</p>


<h3 class="fn"><a name="expandingDirections" /><a href="qt-orientations.html">Qt.Orientations</a> QLayoutItem.expandingDirections (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns whether this layout item can make use of more space than
<a href="qlayoutitem.html#sizeHint">sizeHint</a>(). A value of
<a href="qt.html#Orientation-enum">Qt.Vertical</a> or <a href="qt.html#Orientation-enum">Qt.Horizontal</a> means that it wants
to grow in only one dimension, whereas <a href="qt.html#Orientation-enum">Qt.Vertical</a> | <a href="qt.html#Orientation-enum">Qt.Horizontal</a> means that it wants
to grow in both dimensions.</p>


<h3 class="fn"><a name="geometry" /><a href="qrect.html">QRect</a> QLayoutItem.geometry (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the rectangle covered by this layout item.</p>
<p><b>See also</b> <a href="qlayoutitem.html#setGeometry">setGeometry</a>().</p>


<h3 class="fn"><a name="hasHeightForWidth" />bool QLayoutItem.hasHeightForWidth (<i>self</i>)</h3><p>Returns true if this layout's preferred height depends on its
width; otherwise returns false. The default implementation returns
false.</p>
<p>Reimplement this function in layout managers that support height
for width.</p>
<p><b>See also</b> <a href="qlayoutitem.html#heightForWidth">heightForWidth</a>() and <a href="qwidget.html#heightForWidth">QWidget.heightForWidth</a>().</p>


<h3 class="fn"><a name="heightForWidth" />int QLayoutItem.heightForWidth (<i>self</i>, int)</h3><p>Returns the preferred height for this layout item, given the
width <i>w</i>.</p>
<p>The default implementation returns -1, indicating that the
preferred height is independent of the width of the item. Using the
function <a href="qlayoutitem.html#hasHeightForWidth">hasHeightForWidth</a>() will
typically be much faster than calling this function and testing for
-1.</p>
<p>Reimplement this function in layout managers that support height
for width. A typical implementation will look like this:</p>
<pre class="cpp">
 <span class="type">int</span> MyLayout<span class="operator">.</span>heightForWidth(<span class="type">int</span> w) <span class="keyword">const</span>
 {
     <span class="keyword">if</span> (cache_dirty <span class="operator">|</span><span class="operator">|</span> cached_width <span class="operator">!</span><span class="operator">=</span> w) {
         <span class="comment">// not all C++ compilers support "mutable"</span>
         MyLayout <span class="operator">*</span>that <span class="operator">=</span> (MyLayout<span class="operator">*</span>)<span class="keyword">this</span>;
         <span class="type">int</span> h <span class="operator">=</span> calculateHeightForWidth(w);
         that<span class="operator">-</span><span class="operator">&gt;</span>cached_hfw <span class="operator">=</span> h;
         <span class="keyword">return</span> h;
     }
     <span class="keyword">return</span> cached_hfw;
 }
</pre>
<p>Caching is strongly recommended; without it layout will take
exponential time.</p>
<p><b>See also</b> <a href="qlayoutitem.html#hasHeightForWidth">hasHeightForWidth</a>().</p>


<h3 class="fn"><a name="invalidate" />QLayoutItem.invalidate (<i>self</i>)</h3><p>Invalidates any cached information in this layout item.</p>


<h3 class="fn"><a name="isEmpty" />bool QLayoutItem.isEmpty (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Implemented in subclasses to return whether this item is empty,
i.e. whether it contains any widgets.</p>


<h3 class="fn"><a name="layout" /><a href="qlayout.html">QLayout</a> QLayoutItem.layout (<i>self</i>)</h3><p>If this item is a <a href="qlayout.html">QLayout</a>, it is
returned as a <a href="qlayout.html">QLayout</a>; otherwise 0 is
returned. This function provides type-safe casting.</p>


<h3 class="fn"><a name="maximumSize" /><a href="qsize.html">QSize</a> QLayoutItem.maximumSize (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Implemented in subclasses to return the maximum size of this
item.</p>


<h3 class="fn"><a name="minimumHeightForWidth" />int QLayoutItem.minimumHeightForWidth (<i>self</i>, int)</h3><p>Returns the minimum height this widget needs for the given
width, <i>w</i>. The default implementation simply returns
heightForWidth(<i>w</i>).</p>


<h3 class="fn"><a name="minimumSize" /><a href="qsize.html">QSize</a> QLayoutItem.minimumSize (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Implemented in subclasses to return the minimum size of this
item.</p>


<h3 class="fn"><a name="setAlignment" />QLayoutItem.setAlignment (<i>self</i>, <a href="qt-alignment.html">Qt.Alignment</a>&#160;<i>a</i>)</h3><p>Sets the alignment of this item to <i>alignment</i>.</p>
<p><b>Note:</b> Item alignment is only supported by <a href="qlayoutitem.html">QLayoutItem</a> subclasses where it would have a
visual effect. Except for <a href="qspaceritem.html">QSpacerItem</a>, which provides blank space for
layouts, all public Qt classes that inherit <a href="qlayoutitem.html">QLayoutItem</a> support item alignment.</p>
<p><b>See also</b> <a href="qlayoutitem.html#alignment">alignment</a>().</p>


<h3 class="fn"><a name="setGeometry" />QLayoutItem.setGeometry (<i>self</i>, <a href="qrect.html">QRect</a>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Implemented in subclasses to set this item's geometry to
<i>r</i>.</p>
<p><b>See also</b> <a href="qlayoutitem.html#geometry">geometry</a>().</p>


<h3 class="fn"><a name="sizeHint" /><a href="qsize.html">QSize</a> QLayoutItem.sizeHint (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Implemented in subclasses to return the preferred size of this
item.</p>


<h3 class="fn"><a name="spacerItem" /><a href="qspaceritem.html">QSpacerItem</a> QLayoutItem.spacerItem (<i>self</i>)</h3><p>If this item is a <a href="qspaceritem.html">QSpacerItem</a>, it
is returned as a <a href="qspaceritem.html">QSpacerItem</a>;
otherwise 0 is returned. This function provides type-safe
casting.</p>


<h3 class="fn"><a name="widget" /><a href="qwidget.html">QWidget</a> QLayoutItem.widget (<i>self</i>)</h3><p>If this item is a <a href="qwidget.html">QWidget</a>, it is
returned as a <a href="qwidget.html">QWidget</a>; otherwise 0 is
returned. This function provides type-safe casting.</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.12.1 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.qt.io">The Qt Company</a> 2015</td><td align="right" width="25%">Qt&#160;4.8.7</td></tr></table></div></address></body></html>