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

QHBoxLayout Class Reference

Inheritance diagram for QHBoxLayout:

QBoxLayout QLayout QObject QLayoutItem

List of all members.


Detailed Description

The QHBoxLayout class lines up widgets horizontally.

This class is used to construct horizontal box layout objects. See QBoxLayout for details.

The simplest use of the class is like this:

doc/src/snippets/layouts/layouts.cpp 0 doc/src/snippets/layouts/layouts.cpp 1 doc/src/snippets/layouts/layouts.cpp 2 doc/src/snippets/layouts/layouts.cpp 3 doc/src/snippets/layouts/layouts.cpp 4 doc/src/snippets/layouts/layouts.cpp 5

First, we create the widgets we want in the layout. Then, we create the QHBoxLayout object and add the widgets into the layout. Finally, we call QWidget::setLayout() to install the QHBoxLayout object onto the widget. At that point, the widgets in the layout are reparented to have window as their parent.

Horizontal box layout with five child widgets

See also:
QVBoxLayout, QGridLayout, QStackedLayout, {Layout Classes}, {Basic Layouts Example}

Definition at line 129 of file qboxlayout.h.


Public Types

enum  Direction {
  LeftToRight, RightToLeft, TopToBottom, BottomToTop,
  Down = TopToBottom, Up = BottomToTop
}
enum  SizeConstraint {
  SetDefaultConstraint, SetNoConstraint, SetMinimumSize, SetFixedSize,
  SetMaximumSize, SetMinAndMaxSize
}

Public Slots

void deleteLater ()

Signals

void destroyed (QObject *=0)

Public Member Functions

bool activate ()
void addItem (QLayoutItem *)
void addLayout (QLayout *layout, int stretch=0)
void addSpacerItem (QSpacerItem *spacerItem)
void addSpacing (int size)
void addStretch (int stretch=0)
void addStrut (int)
void addWidget (QWidget *w)
void addWidget (QWidget *, int stretch=0, Qt::Alignment alignment=0)
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
int count () const
Direction direction () const
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 &aName=QString()) const
template<typename T>
QList< T > findChildren (const QRegExp &re) const
template<typename T>
QList< T > findChildren (const QString &aName=QString()) const
QRect geometry () const
void getContentsMargins (int *left, int *top, int *right, int *bottom) const
bool hasHeightForWidth () const
int heightForWidth (int) const
virtual int indexOf (QWidget *) const
bool inherits (const char *classname) const
void insertLayout (int index, QLayout *layout, int stretch=0)
void insertSpacerItem (int index, QSpacerItem *spacerItem)
void insertSpacing (int index, int size)
void insertStretch (int index, int stretch=0)
void insertWidget (int index, QWidget *widget, int stretch=0, Qt::Alignment alignment=0)
void installEventFilter (QObject *)
void invalidate ()
bool isEmpty () const
bool isEnabled () const
bool isWidgetType () const
QLayoutItemitemAt (int) const
void killTimer (int id)
QLayoutlayout ()
int margin () const
QSize maximumSize () const
QWidgetmenuBar () const
int minimumHeightForWidth (int) const
QSize minimumSize () const
void moveToThread (QThread *thread)
QString objectName () const
QObjectparent () const
QWidgetparentWidget () const
QVariant property (const char *name) const
 QHBoxLayout (QWidget *parent)
 QHBoxLayout ()
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 setDirection (Direction)
void setEnabled (bool)
void setGeometry (const QRect &)
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 spacing)
bool setStretchFactor (QLayout *l, int stretch)
bool setStretchFactor (QWidget *w, int stretch)
void setUserData (uint id, QObjectUserData *data)
bool signalsBlocked () const
SizeConstraint sizeConstraint () const
QSize sizeHint () const
virtual QSpacerItemspacerItem ()
int spacing () const
int startTimer (int interval)
QLayoutItemtakeAt (int)
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 ()
 ~QHBoxLayout ()

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)
void insertItem (int index, QLayoutItem *)
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

Properties

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

Friends

class QApplication
class QCoreApplication
class QCoreApplicationPrivate
struct QMetaObject
class QThreadData

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)
 QObjectList
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