You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
227 lines
8.0 KiB
227 lines
8.0 KiB
'\" 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 TQWidget * \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 TQWidget, 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 TQt::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 TQWidget::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 TQt::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 "TQWidget * QLayoutItem::widget ()\fC [virtual]\fR"
|
|
If this item is a TQWidget, it is returned as a TQWidget; 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).
|