This class is used to construct vertical box layout objects. See QBoxLayout for details.
The simplest use of the class is like this:
snippets/layouts/layouts.cpp layout = new QHBoxLayout window = new QWidget window button1 button5 layout = new QVBoxLayout window->setLayout(layout) show
First, we create the widgets we want in the layout. Then, we create the QVBoxLayout object and add the widgets into the layout. Finally, we call QWidget::setLayout() to install the QVBoxLayout 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
Definition at line 121 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 | 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 QObjectList & | children () const |
bool | connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) 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< QByteArray > | dynamicPropertyNames () const |
virtual bool | event (QEvent *) |
virtual bool | eventFilter (QObject *, QEvent *) |
Qt::Orientations | expandingDirections () const |
template<typename T> | |
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 |
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 | 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 |
QLayoutItem * | itemAt (int) const |
void | killTimer (int id) |
QLayout * | layout () |
int | margin () const |
QSize | maximumSize () const |
QWidget * | menuBar () const |
int | minimumHeightForWidth (int) const |
QSize | minimumSize () const |
void | moveToThread (QThread *thread) |
QString | objectName () const |
QObject * | parent () const |
QWidget * | parentWidget () const |
QVariant | property (const char *name) const |
QVBoxLayout (QWidget *parent) | |
QVBoxLayout () | |
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 | 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) |
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 QSpacerItem * | spacerItem () |
int | spacing () const |
int | startTimer (int interval) |
QLayoutItem * | takeAt (int) |
QThread * | thread () const |
int | totalHeightForWidth (int w) const |
QSize | totalMaximumSize () const |
QSize | totalMinimumSize () const |
QSize | totalSizeHint () const |
void | update () |
QObjectUserData * | userData (uint id) const |
virtual QWidget * | widget () |
~QVBoxLayout () | |
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 |
QObject * | sender () 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.) | |
T | qFindChild (const QObject *obj, const QString &name=QString(), T dummy=0) |
T | 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 ®Exp) |
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) |