1QLayoutItem(3qt) QLayoutItem(3qt)
2
3
4
6 QLayoutItem - Abstract item that a QLayout manipulates
7
9 #include <qlayout.h>
10
11 Inherited by QLayout, QSpacerItem, and QWidgetItem.
12
13 Public Members
14 QLayoutItem ( int alignment = 0 )
15 virtual ~QLayoutItem ()
16 virtual QSize sizeHint () const = 0
17 virtual QSize minimumSize () const = 0
18 virtual QSize maximumSize () const = 0
19 virtual QSizePolicy::ExpandData expanding () const = 0
20 virtual void setGeometry ( const QRect & r ) = 0
21 virtual QRect geometry () const = 0
22 virtual bool isEmpty () const = 0
23 virtual bool hasHeightForWidth () const
24 virtual int heightForWidth ( int w ) const
25 virtual void invalidate ()
26 virtual QWidget * widget ()
27 virtual QLayoutIterator iterator ()
28 virtual QLayout * layout ()
29 virtual QSpacerItem * spacerItem ()
30 int alignment () const
31 virtual void setAlignment ( int a )
32
34 The QLayoutItem class provides an abstract item that a QLayout
35 manipulates.
36
37 This is used by custom layouts.
38
39 Pure virtual functions are provided to return information about the
40 layout, including, sizeHint(), minimumSize(), maximumSize() and
41 expanding().
42
43 The layout's geometry can be set and retrieved with setGeometry() and
44 geometry(), and its alignment with setAlignment() and alignment().
45
46 isEmpty() returns whether the layout is empty. iterator() returns an
47 iterator for the layout's children. If the concrete item is a QWidget,
48 it can be retrieved using widget(). Similarly for layout() and
49 spacerItem().
50
51 See also QLayout, Widget Appearance and Style, and Layout Management.
52
55 Constructs a layout item with an alignment that is a bitwise OR of the
56 Qt::AlignmentFlags. Not all subclasses support alignment.
57
59 Destroys the QLayoutItem.
60
62 Returns the alignment of this item.
63
65 Implemented in subclasses to return the direction(s) this item" wants"
66 to expand in (if any).
67
68 Reimplemented in QLayout, QSpacerItem, and QWidgetItem.
69
71 Returns the rectangle covered by this layout item.
72
73 Example: customlayout/border.cpp.
74
76 Returns TRUE if this layout's preferred height depends on its width;
77 otherwise returns FALSE. The default implementation returns FALSE.
78
79 Reimplement this function in layout managers that support height for
80 width.
81
82 See also heightForWidth() and QWidget::heightForWidth().
83
84 Examples:
85
86 Reimplemented in QGridLayout and QBoxLayout.
87
89 Returns the preferred height for this layout item, given the width w.
90
91 The default implementation returns -1, indicating that the preferred
92 height is independent of the width of the item. Using the function
93 hasHeightForWidth() will typically be much faster than calling this
94 function and testing for -1.
95
96 Reimplement this function in layout managers that support height for
97 width. A typical implementation will look like this:
98
99 int MyLayout::heightForWidth( int w ) const
100 {
101 if ( cache_dirty || cached_width != w ) {
102 // not all C++ compilers support "mutable"
103 MyLayout *that = (MyLayout*)this;
104 int h = calculateHeightForWidth( w );
105 that->cached_hfw = h;
106 return h;
107 }
108 return cached_hfw;
109 }
110
111 Caching is strongly recommended; without it layout will take
112 exponential time.
113
114 See also hasHeightForWidth().
115
116 Example: customlayout/flow.cpp.
117
118 Reimplemented in QGridLayout and QBoxLayout.
119
121 Invalidates any cached information in this layout item.
122
123 Reimplemented in QLayout.
124
126 Implemented in subclasses to return whether this item is empty, i.e.
127 whether it contains any widgets.
128
129 Reimplemented in QLayout, QSpacerItem, and QWidgetItem.
130
132 Returns an iterator over this item's QLayoutItem children. The default
133 implementation returns an empty iterator.
134
135 Reimplement this function in subclasses that can have children.
136
137 Reimplemented in QLayout.
138
140 If this item is a QLayout, it is returned as a QLayout; otherwise 0 is
141 returned. This function provides type-safe casting.
142
144 Implemented in subclasses to return the maximum size of this item.
145
146 Reimplemented in QLayout, QSpacerItem, and QWidgetItem.
147
149 Implemented in subclasses to return the minimum size of this item.
150
151 Examples:
152
153 Reimplemented in QLayout, QSpacerItem, and QWidgetItem.
154
156 Sets the alignment of this item to a, which is a bitwise OR of the
157 Qt::AlignmentFlags. Not all subclasses support alignment.
158
159 Example: chart/optionsform.cpp.
160
162 Implemented in subclasses to set this item's geometry to r.
163
164 Examples:
165
166 Reimplemented in QLayout, QSpacerItem, and QWidgetItem.
167
169 Implemented in subclasses to return the preferred size of this item.
170
171 Examples:
172
173 Reimplemented in QSpacerItem, QWidgetItem, QGridLayout, and QBoxLayout.
174
176 If this item is a QSpacerItem, it is returned as a QSpacerItem;
177 otherwise 0 is returned. This function provides type-safe casting.
178
180 If this item is a QWidget, it is returned as a QWidget; otherwise 0 is
181 returned. This function provides type-safe casting.
182
183 Reimplemented in QWidgetItem.
184
185
187 http://doc.trolltech.com/qlayoutitem.html
188 http://www.trolltech.com/faq/tech.html
189
191 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
192 license file included in the distribution for a complete license
193 statement.
194
196 Generated automatically from the source code.
197
199 If you find a bug in Qt, please report it as described in
200 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
201 help you. Thank you.
202
203 The definitive Qt documentation is provided in HTML format; it is
204 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
205 web browser. This man page is provided as a convenience for those users
206 who prefer man pages, although this format is not officially supported
207 by Trolltech.
208
209 If you find errors in this manual page, please report them to qt-
210 bugs@trolltech.com. Please include the name of the manual page
211 (qlayoutitem.3qt) and the Qt version (3.3.8).
212
213
214
215Trolltech AS 2 February 2007 QLayoutItem(3qt)