Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

QLayout Class Reference

Inheritance diagram for QLayout:

QObject QLayoutItem QBoxLayout QGridLayout QStackedLayout QHBoxLayout QVBoxLayout

List of all members.

Detailed Description

The QLayout class is the base class of geometry managers.

This is an abstract base class inherited by the concrete classes QBoxLayout, QGridLayout, and QStackedLayout.

For users of QLayout subclasses or of QMainWindow there is seldom any need to use the basic functions provided by QLayout, such as setSizeConstraint() or setMenuBar(). See {Layout Classes} for more information.

To make your own layout manager, implement the functions addItem(), sizeHint(), setGeometry(), itemAt() and takeAt(). You should also implement minimumSize() to ensure your layout isn't resized to zero size if there is too little space. To support children whose heights depend on their widths, implement hasHeightForWidth() and heightForWidth(). See the {layouts/borderlayout}{Border Layout} and {layouts/flowlayout}{Flow Layout} examples for more information about implementing custom layout managers.

Geometry management stops when the layout manager is deleted.

See also:
QLayoutItem, {Layout Classes}, {Basic Layouts Example}, {Border Layout Example}, {Flow Layout Example}

Definition at line 89 of file qlayout.h.

Public Types

enum  SizeConstraint {
  SetDefaultConstraint, SetNoConstraint, SetMinimumSize, SetFixedSize,
  SetMaximumSize, SetMinAndMaxSize

Public Slots

void deleteLater ()


void destroyed (QObject *=0)

Public Member Functions

bool activate ()
virtual void addItem (QLayoutItem *)=0
void addWidget (QWidget *w)
Qt::Alignment alignment () const
bool blockSignals (bool b)
const QObjectListchildren () const
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
QRect contentsRect () const
QSizePolicy::ControlTypes controlTypes () const
virtual int count () const =0
bool disconnect (const QObject *receiver, const char *member=0)
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
void dumpObjectInfo ()
void dumpObjectTree ()
QList< QByteArraydynamicPropertyNames () const
virtual bool event (QEvent *)
virtual bool eventFilter (QObject *, QEvent *)
Qt::Orientations expandingDirections () const
template<typename T>
findChild (const QString &name=QString()) const
template<typename T>
QList< T > findChildren (const QRegExp &re) const
template<typename T>
QList< T > findChildren (const QString &name=QString()) const
QRect geometry () const
void getContentsMargins (int *left, int *top, int *right, int *bottom) const
virtual bool hasHeightForWidth () const
virtual int heightForWidth (int) const
virtual int indexOf (QWidget *) const
bool inherits (const char *classname) const
void installEventFilter (QObject *)
void invalidate ()
bool isEmpty () const
bool isEnabled () const
bool isWidgetType () const
virtual QLayoutItemitemAt (int index) const =0
void killTimer (int id)
QLayoutlayout ()
int margin () const
QSize maximumSize () const
QWidgetmenuBar () const
virtual int minimumHeightForWidth (int) const
QSize minimumSize () const
void moveToThread (QThread *thread)
QString objectName () const
QObjectparent () const
QWidgetparentWidget () const
QVariant property (const char *name) const
 QLayout ()
 QLayout (QWidget *parent)
void removeEventFilter (QObject *)
void removeItem (QLayoutItem *)
void removeWidget (QWidget *w)
void setAlignment (Qt::Alignment a)
bool setAlignment (QLayout *l, Qt::Alignment alignment)
bool setAlignment (QWidget *w, Qt::Alignment alignment)
void setContentsMargins (int left, int top, int right, int bottom)
void setEnabled (bool)
void setGeometry (const QRect &)=0
void setMargin (int)
void setMenuBar (QWidget *w)
void setObjectName (const QString &name)
void setParent (QObject *)
bool setProperty (const char *name, const QVariant &value)
void setSizeConstraint (SizeConstraint)
void setSpacing (int)
void setUserData (uint id, QObjectUserData *data)
bool signalsBlocked () const
SizeConstraint sizeConstraint () const
virtual QSize sizeHint () const =0
virtual QSpacerItemspacerItem ()
int spacing () const
int startTimer (int interval)
virtual QLayoutItemtakeAt (int index)=0
QThreadthread () const
int totalHeightForWidth (int w) const
QSize totalMaximumSize () const
QSize totalMinimumSize () const
QSize totalSizeHint () const
void update ()
QObjectUserData * userData (uint id) const
virtual QWidgetwidget ()
 ~QLayout ()

Static Public Member Functions

static QSize closestAcceptableSize (const QWidget *w, const QSize &s)
static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
static uint registerUserData ()

Protected Member Functions

void addChildLayout (QLayout *l)
void addChildWidget (QWidget *w)
QRect alignmentRect (const QRect &) const
void childEvent (QChildEvent *e)
virtual void connectNotify (const char *signal)
virtual void customEvent (QEvent *)
virtual void disconnectNotify (const char *signal)
 QLayout (QLayoutPrivate &d, QLayout *, QWidget *)
int receivers (const char *signal) const
QObjectsender () const
virtual void timerEvent (QTimerEvent *)
void widgetEvent (QEvent *)

Protected Attributes

Qt::Alignment align
QObjectData * d_ptr

Static Protected Attributes

static const QMetaObject staticQtMetaObject


int margin
 the width of the outside border of the layout
QString objectName
 the name of this object
SizeConstraint sizeConstraint
 the resize mode of the layout
int spacing
 the spacing between widgets inside the layout

Static Private Member Functions

static void activateRecursiveHelper (QLayoutItem *item)


class QApplication
class QApplicationPrivate
class QCoreApplication
class QCoreApplicationPrivate
struct QMetaObject
class QThreadData
class QWidget

Related Functions

(Note that these are not member functions.)

qFindChild (const QObject *obj, const QString &name=QString(), T dummy=0)
qFindChild (const QObject *obj, const QString &name)
QList< T > qFindChildren (const QObject *obj, const QString &name=QString(), T dummy=0)
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
QList< T > qFindChildren (const QObject *obj, const QString &name)
T * qobject_cast (QObject *object)
void * qt_find_obj_child (QObject *parent, const char *type, const QString &name)

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index