summaryrefslogtreecommitdiffstats
path: root/doc/man/man3/tqlayoutitem.3qt
blob: 26a5d037efdd2f165a4d2f715f2235a5b046d30f (plain)
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
'\" t
.TH QLayoutItem 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA.  All rights reserved.  See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QLayoutItem \- Abstract item that a QLayout manipulates
.SH SYNOPSIS
\fC#include <ntqlayout.h>\fR
.PP
Inherited by QLayout, QSpacerItem, and QWidgetItem.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQLayoutItem\fR ( int alignment = 0 )"
.br
.ti -1c
.BI "virtual \fB~QLayoutItem\fR ()"
.br
.ti -1c
.BI "virtual QSize \fBsizeHint\fR () const = 0"
.br
.ti -1c
.BI "virtual QSize \fBminimumSize\fR () const = 0"
.br
.ti -1c
.BI "virtual QSize \fBmaximumSize\fR () const = 0"
.br
.ti -1c
.BI "virtual QSizePolicy::ExpandData \fBexpanding\fR () const = 0"
.br
.ti -1c
.BI "virtual void \fBsetGeometry\fR ( const QRect & r ) = 0"
.br
.ti -1c
.BI "virtual QRect \fBgeometry\fR () const = 0"
.br
.ti -1c
.BI "virtual bool \fBisEmpty\fR () const = 0"
.br
.ti -1c
.BI "virtual bool \fBhasHeightForWidth\fR () const"
.br
.ti -1c
.BI "virtual int \fBheightForWidth\fR ( int w ) const"
.br
.ti -1c
.BI "virtual void \fBinvalidate\fR ()"
.br
.ti -1c
.BI "virtual QWidget * \fBwidget\fR ()"
.br
.ti -1c
.BI "virtual QLayoutIterator \fBiterator\fR ()"
.br
.ti -1c
.BI "virtual QLayout * \fBlayout\fR ()"
.br
.ti -1c
.BI "virtual QSpacerItem * \fBspacerItem\fR ()"
.br
.ti -1c
.BI "int \fBalignment\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetAlignment\fR ( int a )"
.br
.in -1c
.SH DESCRIPTION
The QLayoutItem class provides an abstract item that a QLayout manipulates.
.PP
This is used by custom layouts.
.PP
Pure virtual functions are provided to return information about the layout, including, sizeHint(), minimumSize(), maximumSize() and expanding().
.PP
The layout's geometry can be set and retrieved with setGeometry() and geometry(), and its alignment with setAlignment() and alignment().
.PP
isEmpty() returns whether the layout is empty. iterator() returns an iterator for the layout's children. If the concrete item is a QWidget, it can be retrieved using widget(). Similarly for layout() and spacerItem().
.PP
See also QLayout, Widget Appearance and Style, and Layout Management.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QLayoutItem::QLayoutItem ( int alignment = 0 )"
Constructs a layout item with an \fIalignment\fR that is a bitwise OR of the Qt::AlignmentFlags. Not all subclasses support alignment.
.SH "QLayoutItem::~QLayoutItem ()\fC [virtual]\fR"
Destroys the QLayoutItem.
.SH "int QLayoutItem::alignment () const"
Returns the alignment of this item.
.SH "QSizePolicy::ExpandData QLayoutItem::expanding () const\fC [pure virtual]\fR"
Implemented in subclasses to return the direction(s) this item" wants" to expand in (if any).
.PP
Reimplemented in QLayout, QSpacerItem, and QWidgetItem.
.SH "QRect QLayoutItem::geometry () const\fC [pure virtual]\fR"
Returns the rectangle covered by this layout item.
.PP
Example: customlayout/border.cpp.
.SH "bool QLayoutItem::hasHeightForWidth () const\fC [virtual]\fR"
Returns TRUE if this layout's preferred height depends on its width; otherwise returns FALSE. The default implementation returns FALSE.
.PP
Reimplement this function in layout managers that support height for width.
.PP
See also heightForWidth() and QWidget::heightForWidth().
.PP
Examples:
.)l customlayout/border.cpp and customlayout/flow.cpp.
.PP
Reimplemented in QGridLayout and QBoxLayout.
.SH "int QLayoutItem::heightForWidth ( int w ) const\fC [virtual]\fR"
Returns the preferred height for this layout item, given the width \fIw\fR.
.PP
The default implementation returns -1, indicating that the preferred height is independent of the width of the item. Using the function hasHeightForWidth() will typically be much faster than calling this function and testing for -1.
.PP
Reimplement this function in layout managers that support height for width. A typical implementation will look like this:
.PP
.nf
.br
        int MyLayout::heightForWidth( int w ) const
.br
        {
.br
            if ( cache_dirty || cached_width != w ) {
.br
                // not all C++ compilers support "mutable"
.br
                MyLayout *that = (MyLayout*)this;
.br
                int h = calculateHeightForWidth( w );
.br
                that->cached_hfw = h;
.br
                return h;
.br
            }
.br
            return cached_hfw;
.br
        }
.br
.fi
.PP
Caching is strongly recommended; without it layout will take exponential time.
.PP
See also hasHeightForWidth().
.PP
Example: customlayout/flow.cpp.
.PP
Reimplemented in QGridLayout and QBoxLayout.
.SH "void QLayoutItem::invalidate ()\fC [virtual]\fR"
Invalidates any cached information in this layout item.
.PP
Reimplemented in QLayout.
.SH "bool QLayoutItem::isEmpty () const\fC [pure virtual]\fR"
Implemented in subclasses to return whether this item is empty, i.e. whether it contains any widgets.
.PP
Reimplemented in QLayout, QSpacerItem, and QWidgetItem.
.SH "QLayoutIterator QLayoutItem::iterator ()\fC [virtual]\fR"
Returns an iterator over this item's QLayoutItem children. The default implementation returns an empty iterator.
.PP
Reimplement this function in subclasses that can have children.
.PP
Reimplemented in QLayout.
.SH "QLayout * QLayoutItem::layout ()\fC [virtual]\fR"
If this item is a QLayout, it is returned as a QLayout; otherwise 0 is returned. This function provides type-safe casting.
.SH "QSize QLayoutItem::maximumSize () const\fC [pure virtual]\fR"
Implemented in subclasses to return the maximum size of this item.
.PP
Reimplemented in QLayout, QSpacerItem, and QWidgetItem.
.SH "QSize QLayoutItem::minimumSize () const\fC [pure virtual]\fR"
Implemented in subclasses to return the minimum size of this item.
.PP
Examples:
.)l customlayout/border.cpp, customlayout/card.cpp, and customlayout/flow.cpp.
.PP
Reimplemented in QLayout, QSpacerItem, and QWidgetItem.
.SH "void QLayoutItem::setAlignment ( int a )\fC [virtual]\fR"
Sets the alignment of this item to \fIa\fR, which is a bitwise OR of the Qt::AlignmentFlags. Not all subclasses support alignment.
.PP
Example: chart/optionsform.cpp.
.SH "void QLayoutItem::setGeometry ( const QRect & r )\fC [pure virtual]\fR"
Implemented in subclasses to set this item's geometry to \fIr\fR.
.PP
Examples:
.)l customlayout/border.cpp, customlayout/card.cpp, and customlayout/flow.cpp.
.PP
Reimplemented in QLayout, QSpacerItem, and QWidgetItem.
.SH "QSize QLayoutItem::sizeHint () const\fC [pure virtual]\fR"
Implemented in subclasses to return the preferred size of this item.
.PP
Examples:
.)l customlayout/border.cpp, customlayout/card.cpp, and customlayout/flow.cpp.
.PP
Reimplemented in QSpacerItem, QWidgetItem, QGridLayout, and QBoxLayout.
.SH "QSpacerItem * QLayoutItem::spacerItem ()\fC [virtual]\fR"
If this item is a QSpacerItem, it is returned as a QSpacerItem; otherwise 0 is returned. This function provides type-safe casting.
.SH "QWidget * QLayoutItem::widget ()\fC [virtual]\fR"
If this item is a QWidget, it is returned as a QWidget; otherwise 0 is returned. This function provides type-safe casting.
.PP
Reimplemented in QWidgetItem.

.SH "SEE ALSO"
.BR http://doc.trolltech.com/qlayoutitem.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive TQt documentation is provided in HTML format; it is
located at $TQTDIR/doc/html and can be read using TQt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech. 
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (tqlayoutitem.3qt) and the Qt
version (3.3.8).