Qt 4.8
|
The QLayout class is the base class of geometry managers. More...
#include <qlayout.h>
Public Types | |
enum | SizeConstraint { SetDefaultConstraint, SetNoConstraint, SetMinimumSize, SetFixedSize, SetMaximumSize, SetMinAndMaxSize } |
The possible values are: More... | |
Public Functions | |
bool | activate () |
Redoes the layout for parentWidget() if necessary. More... | |
virtual void | addItem (QLayoutItem *)=0 |
Implemented in subclasses to add an item. More... | |
void | addWidget (QWidget *w) |
Adds widget w to this layout in a manner specific to the layout. More... | |
QMargins | contentsMargins () const |
Returns the margins used around the layout. More... | |
QRect | contentsRect () const |
Returns the layout's geometry() rectangle, but taking into account the contents margins. More... | |
virtual int | count () const =0 |
Must be implemented in subclasses to return the number of items in the layout. More... | |
Qt::Orientations | expandingDirections () const |
Returns whether this layout can make use of more space than sizeHint(). More... | |
QRect | geometry () const |
Reimplemented Function More... | |
void | getContentsMargins (int *left, int *top, int *right, int *bottom) const |
virtual int | indexOf (QWidget *) const |
Searches for widget widget in this layout (not including child layouts). More... | |
void | invalidate () |
Reimplemented Function More... | |
bool | isEmpty () const |
Reimplemented Function More... | |
bool | isEnabled () const |
Returns true if the layout is enabled; otherwise returns false. More... | |
virtual QLayoutItem * | itemAt (int index) const =0 |
Must be implemented in subclasses to return the layout item at index. More... | |
QLayout * | layout () |
Reimplemented Function More... | |
int | margin () const |
QSize | maximumSize () const |
Returns the maximum size of this layout. More... | |
QWidget * | menuBar () const |
Returns the menu bar set for this layout, or 0 if no menu bar is set. More... | |
QSize | minimumSize () const |
Returns the minimum size of this layout. More... | |
QWidget * | parentWidget () const |
Returns the parent widget of this layout, or 0 if this layout is not installed on any widget. More... | |
QLayout (QWidget *parent) | |
Constructs a new top-level QLayout, with parent parent. More... | |
QLayout () | |
Constructs a new child QLayout. More... | |
void | removeItem (QLayoutItem *) |
Removes the layout item item from the layout. More... | |
void | removeWidget (QWidget *w) |
Removes the widget widget from the layout. More... | |
bool | setAlignment (QWidget *w, Qt::Alignment alignment) |
Sets the alignment for widget w to alignment and returns true if w is found in this layout (not including child layouts); otherwise returns false. More... | |
bool | setAlignment (QLayout *l, Qt::Alignment alignment) |
Sets the alignment for the layout l to alignment and returns true if l is found in this layout (not including child layouts); otherwise returns false. More... | |
void | setContentsMargins (int left, int top, int right, int bottom) |
Sets the left, top, right, and bottom margins to use around the layout. More... | |
void | setContentsMargins (const QMargins &margins) |
Sets the margins to use around the layout. More... | |
void | setEnabled (bool) |
Enables this layout if enable is true, otherwise disables it. More... | |
virtual void | setGeometry (const QRect &) |
Reimplemented Function More... | |
void | setMargin (int) |
void | setMenuBar (QWidget *w) |
Tells the geometry manager to place the menu bar widget at the top of parentWidget(), outside QWidget::contentsMargins(). More... | |
void | setSizeConstraint (SizeConstraint) |
void | setSpacing (int) |
SizeConstraint | sizeConstraint () const |
int | spacing () const |
virtual QLayoutItem * | takeAt (int index)=0 |
Must be implemented in subclasses to remove the layout item at index from the layout, and return the item. More... | |
int | totalHeightForWidth (int w) const |
Also takes contentsMargins and menu bar into account. More... | |
QSize | totalMaximumSize () const |
Also takes contentsMargins and menu bar into account. More... | |
QSize | totalMinimumSize () const |
Also takes contentsMargins and menu bar into account. More... | |
QSize | totalSizeHint () const |
Also takes contentsMargins and menu bar into account. More... | |
void | update () |
Updates the layout for parentWidget(). More... | |
~QLayout () | |
Destroys the layout, deleting all child layouts. More... | |
Public Functions inherited from QObject | |
bool | blockSignals (bool b) |
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More... | |
const QObjectList & | children () const |
Returns a list of child objects. More... | |
bool | connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const |
bool | disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0) |
bool | disconnect (const QObject *receiver, const char *member=0) |
void | dumpObjectInfo () |
Dumps information about signal connections, etc. More... | |
void | dumpObjectTree () |
Dumps a tree of children to the debug output. More... | |
QList< QByteArray > | dynamicPropertyNames () const |
Returns the names of all properties that were dynamically added to the object using setProperty(). More... | |
virtual bool | event (QEvent *) |
This virtual function receives events to an object and should return true if the event e was recognized and processed. More... | |
virtual bool | eventFilter (QObject *, QEvent *) |
Filters events if this object has been installed as an event filter for the watched object. More... | |
template<typename T > | |
T | findChild (const QString &aName=QString()) const |
Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More... | |
template<typename T > | |
QList< T > | findChildren (const QString &aName=QString()) const |
Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More... | |
template<typename T > | |
QList< T > | findChildren (const QRegExp &re) const |
bool | inherits (const char *classname) const |
Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More... | |
void | installEventFilter (QObject *) |
Installs an event filter filterObj on this object. More... | |
bool | isWidgetType () const |
Returns true if the object is a widget; otherwise returns false. More... | |
void | killTimer (int id) |
Kills the timer with timer identifier, id. More... | |
virtual const QMetaObject * | metaObject () const |
Returns a pointer to the meta-object of this object. More... | |
void | moveToThread (QThread *thread) |
Changes the thread affinity for this object and its children. More... | |
QString | objectName () const |
QObject * | parent () const |
Returns a pointer to the parent object. More... | |
QVariant | property (const char *name) const |
Returns the value of the object's name property. More... | |
Q_INVOKABLE | QObject (QObject *parent=0) |
Constructs an object with parent object parent. More... | |
void | removeEventFilter (QObject *) |
Removes an event filter object obj from this object. More... | |
void | setObjectName (const QString &name) |
void | setParent (QObject *) |
Makes the object a child of parent. More... | |
bool | setProperty (const char *name, const QVariant &value) |
Sets the value of the object's name property to value. More... | |
void | setUserData (uint id, QObjectUserData *data) |
bool | signalsBlocked () const |
Returns true if signals are blocked; otherwise returns false. More... | |
int | startTimer (int interval) |
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More... | |
QThread * | thread () const |
Returns the thread in which the object lives. More... | |
QObjectUserData * | userData (uint id) const |
virtual | ~QObject () |
Destroys the object, deleting all its child objects. More... | |
Public Functions inherited from QLayoutItem | |
Qt::Alignment | alignment () const |
Returns the alignment of this item. More... | |
QSizePolicy::ControlTypes | controlTypes () const |
Returns the control type(s) for the layout item. More... | |
virtual bool | hasHeightForWidth () const |
Returns true if this layout's preferred height depends on its width; otherwise returns false. More... | |
virtual int | heightForWidth (int) const |
Returns the preferred height for this layout item, given the width w. More... | |
virtual int | minimumHeightForWidth (int) const |
Returns the minimum height this widget needs for the given width, w. More... | |
QLayoutItem (Qt::Alignment alignment=0) | |
Constructs a layout item with an alignment. More... | |
void | setAlignment (Qt::Alignment a) |
Sets the alignment of this item to alignment. More... | |
virtual QSize | sizeHint () const =0 |
Implemented in subclasses to return the preferred size of this item. More... | |
virtual QSpacerItem * | spacerItem () |
If this item is a QSpacerItem, it is returned as a QSpacerItem; otherwise 0 is returned. More... | |
virtual QWidget * | widget () |
If this item is a QWidget, it is returned as a QWidget; otherwise 0 is returned. More... | |
virtual | ~QLayoutItem () |
Destroys the QLayoutItem. More... | |
Static Public Functions | |
static QSize | closestAcceptableSize (const QWidget *w, const QSize &s) |
Returns a size that satisfies all size constraints on widget, including heightForWidth() and that is as close as possible to size. More... | |
Static Public Functions inherited from QObject | |
static bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection) |
Creates a connection of the given type from the signal in the sender object to the method in the receiver object. More... | |
static bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member) |
Disconnects signal in object sender from method in object receiver. More... | |
static bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member) |
static uint | registerUserData () |
static QString | tr (const char *sourceText, const char *comment=0, int n=-1) |
static QString | trUtf8 (const char *sourceText, const char *comment=0, int n=-1) |
Protected Functions | |
void | addChildLayout (QLayout *l) |
This function is called from addLayout() or insertLayout() functions in subclasses to add layout l as a sub-layout. More... | |
void | addChildWidget (QWidget *w) |
This function is called from addWidget() functions in subclasses to add w as a managed widget of a layout. More... | |
bool | adoptLayout (QLayout *layout) |
QRect | alignmentRect (const QRect &) const |
Returns the rectangle that should be covered when the geometry of this layout is set to r, provided that this layout supports setAlignment(). More... | |
void | childEvent (QChildEvent *e) |
Reimplemented Function More... | |
QLayout (QLayoutPrivate &d, QLayout *, QWidget *) | |
void | widgetEvent (QEvent *) |
Performs child widget layout when the parent widget is resized. More... | |
Protected Functions inherited from QObject | |
virtual void | connectNotify (const char *signal) |
This virtual function is called when something has been connected to signal in this object. More... | |
virtual void | customEvent (QEvent *) |
This event handler can be reimplemented in a subclass to receive custom events. More... | |
virtual void | disconnectNotify (const char *signal) |
This virtual function is called when something has been disconnected from signal in this object. More... | |
QObject (QObjectPrivate &dd, QObject *parent=0) | |
int | receivers (const char *signal) const |
Returns the number of receivers connected to the signal. More... | |
QObject * | sender () const |
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More... | |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *) |
This event handler can be reimplemented in a subclass to receive timer events for the object. More... | |
Static Private Functions | |
static void | activateRecursiveHelper (QLayoutItem *item) |
Properties | |
int | margin |
the width of the outside border of the layout More... | |
SizeConstraint | sizeConstraint |
the resize mode of the layout More... | |
int | spacing |
the spacing between widgets inside the layout More... | |
Friends | |
class | QApplicationPrivate |
class | QWidget |
Additional Inherited Members | |
Public Slots inherited from QObject | |
void | deleteLater () |
Schedules this object for deletion. More... | |
Signals inherited from QObject | |
void | destroyed (QObject *=0) |
This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More... | |
Static Public Variables inherited from QObject | |
static const QMetaObject | staticMetaObject |
This variable stores the meta-object for the class. More... | |
Protected Variables inherited from QObject | |
QScopedPointer< QObjectData > | d_ptr |
Protected Variables inherited from QLayoutItem | |
Qt::Alignment | align |
Static Protected Variables inherited from QObject | |
static const QMetaObject | staticQtMetaObject |
Related Functions inherited from QObject | |
T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QRegExp ®Exp)() |
T * | qobject_cast (QObject *object) |
QObjectList | |
void * | qt_find_obj_child (QObject *parent, const char *type, const QString &name) |
Returns a pointer to the object named name that inherits type and with a given parent. More... | |
The QLayout class is the base class of geometry managers.
This is an abstract base class inherited by the concrete classes QBoxLayout, QGridLayout, QFormLayout, 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 Management 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 Border Layout and Flow Layout examples for more information about implementing custom layout managers.
Geometry management stops when the layout manager is deleted.
The possible values are:
Enumerator | |
---|---|
SetDefaultConstraint | |
SetNoConstraint | |
SetMinimumSize | |
SetFixedSize | |
SetMaximumSize | |
SetMinAndMaxSize |
Definition at line 100 of file qlayout.h.
QLayout::QLayout | ( | QWidget * | parent | ) |
Constructs a new top-level QLayout, with parent parent.
parent may not be 0.
There can be only one top-level layout for a widget. It is returned by QWidget::layout().
Definition at line 113 of file qlayout.cpp.
QLayout::QLayout | ( | ) |
Constructs a new child QLayout.
This layout has to be inserted into another layout before geometry management will work.
Definition at line 127 of file qlayout.cpp.
Referenced by QLayoutPrivate::createSpacerItem(), QBoxLayout::QBoxLayout(), and QGridLayout::QGridLayout().
QLayout::~QLayout | ( | ) |
Destroys the layout, deleting all child layouts.
Geometry management stops when a top-level layout is deleted.
The layout classes will probably be fatally confused if you delete a sublayout.
Definition at line 936 of file qlayout.cpp.
|
protected |
Definition at line 135 of file qlayout.cpp.
bool QLayout::activate | ( | ) |
Redoes the layout for parentWidget() if necessary.
You should generally not need to call this because it is automatically called at the most appropriate times. It returns true if the layout was redone.
Definition at line 1249 of file qlayout.cpp.
Referenced by QWidgetPrivate::activateChildLayoutsRecursively(), QMessageBoxPrivate::layoutMinimumWidth(), QWidget::setVisible(), QWidgetPrivate::show_recursive(), QComboBox::showPopup(), and QMessageBoxPrivate::updateSize().
|
staticprivate |
Definition at line 1203 of file qlayout.cpp.
|
protected |
This function is called from addLayout()
or insertLayout()
functions in subclasses to add layout l as a sub-layout.
The only scenario in which you need to call it directly is if you implement a custom layout that supports nested layouts.
Definition at line 969 of file qlayout.cpp.
|
protected |
This function is called from addWidget()
functions in subclasses to add w as a managed widget of a layout.
If w is already managed by a layout, this function will give a warning and remove w from that layout. This function must therefore be called before adding w to the layout's data structure.
Definition at line 1045 of file qlayout.cpp.
Referenced by QGridLayout::addWidget(), QStackedLayout::insertWidget(), QBoxLayout::insertWidget(), QMainWindowLayout::setCentralWidget(), QMainWindowLayout::setStatusBar(), and QDockWidgetLayout::setWidgetForRole().
|
pure virtual |
Implemented in subclasses to add an item.
How it is added is specific to each subclass.
This function is not usually called in application code. To add a widget to a layout, use the addWidget() function; to add a child layout, use the addLayout() function provided by the relevant QLayout subclass.
Note: The ownership of item is transferred to the layout, and it's the layout's responsibility to delete it.
Implemented in QMainWindowLayout, QGridLayout, QDockWidgetLayout, QFormLayout, QStackedLayout, QBoxLayout, and QToolBarLayout.
Referenced by QGridLayout::addWidget(), QLayoutPrivate::createSpacerItem(), QHBoxLayout::QHBoxLayout(), QLayout(), and QVBoxLayout::QVBoxLayout().
void QLayout::addWidget | ( | QWidget * | w | ) |
Adds widget w to this layout in a manner specific to the layout.
This function uses addItem().
Definition at line 319 of file qlayout.cpp.
Referenced by QGridLayout::addWidget(), QAbstractScrollAreaScrollBarContainer::QAbstractScrollAreaScrollBarContainer(), QWizardHeader::QWizardHeader(), QToolBoxPrivate::relayout(), QMdiSubWindowPrivate::setSizeGrip(), QMdiSubWindow::setWidget(), and QMenuBarPrivate::updateCornerWidgetToolBar().
|
protected |
Definition at line 987 of file qlayout.cpp.
Referenced by QGridLayout::addLayout(), and QBoxLayout::insertLayout().
Returns the rectangle that should be covered when the geometry of this layout is set to r, provided that this layout supports setAlignment().
The result is derived from sizeHint() and expanding(). It is never larger than r.
Definition at line 1459 of file qlayout.cpp.
Referenced by QBoxLayout::setGeometry(), and QGridLayout::setGeometry().
|
protectedvirtual |
Reimplemented Function
Reimplemented from QObject.
Definition at line 793 of file qlayout.cpp.
Returns a size that satisfies all size constraints on widget, including heightForWidth() and that is as close as possible to size.
Definition at line 1586 of file qlayout.cpp.
Referenced by make_win_eventUPP(), QSizeGrip::mouseMoveEvent(), and QtWndProc().
QMargins QLayout::contentsMargins | ( | ) | const |
Returns the margins used around the layout.
By default, QLayout uses the values provided by the style. On most platforms, the margin is 11 pixels in all directions.
Definition at line 573 of file qlayout.cpp.
QRect QLayout::contentsRect | ( | ) | const |
Returns the layout's geometry() rectangle, but taking into account the contents margins.
Definition at line 591 of file qlayout.cpp.
|
pure virtual |
Must be implemented in subclasses to return the number of items in the layout.
Implemented in QMainWindowLayout, QFormLayout, QDockWidgetLayout, QGridLayout, QBoxLayout, QToolBarLayout, and QStackedLayout.
Referenced by QGridLayout::addWidget(), QLayoutItem::controlTypes(), QAbstractScrollAreaScrollBarContainer::scrollBarLayoutIndex(), QMenuBarPrivate::updateCornerWidgetToolBar(), and QAbstractScrollAreaScrollBarContainer::widgets().
|
virtual |
Returns whether this layout can make use of more space than sizeHint().
A value of Qt::Vertical or Qt::Horizontal means that it wants to grow in only one dimension, whereas Qt::Vertical | Qt::Horizontal means that it wants to grow in both dimensions.
The default implementation returns Qt::Horizontal | Qt::Vertical. Subclasses reimplement it to return a meaningful value based on their child widgets's size policies.
Implements QLayoutItem.
Reimplemented in QToolBarLayout.
Definition at line 1198 of file qlayout.cpp.
Referenced by QWidgetPrivate::adjustedSize().
|
virtual |
Reimplemented Function
Implements QLayoutItem.
Definition at line 664 of file qlayout.cpp.
Referenced by QDockWidgetPrivate::endDrag(), QBoxLayout::setGeometry(), QGridLayout::setGeometry(), QFormLayout::setGeometry(), QDockWidgetLayout::setGeometry(), and QStackedLayout::setStackingMode().
void QLayout::getContentsMargins | ( | int * | left, |
int * | top, | ||
int * | right, | ||
int * | bottom | ||
) | const |
Extracts the left, top, right, and bottom margins used around the layout, and assigns them to *left, *top, *right, and *bottom (unless they are null pointers).
By default, QLayout uses the values provided by the style. On most platforms, the margin is 11 pixels in all directions.
Definition at line 551 of file qlayout.cpp.
Referenced by QFormLayout::heightForWidth(), QFontDialogPrivate::init(), and QFormLayout::setGeometry().
|
virtual |
Searches for widget widget in this layout (not including child layouts).
Returns the index of widget, or -1 if widget is not found.
The default implementation iterates over all items using itemAt()
Reimplemented in QToolBarLayout.
Definition at line 1378 of file qlayout.cpp.
Referenced by QFormLayout::getWidgetPosition(), QToolBarLayout::indexOf(), QGridLayout::minimumHeightForWidth(), QStackedLayout::setCurrentWidget(), and QMdiSubWindowPrivate::setSizeGrip().
|
virtual |
Reimplemented Function
Reimplemented from QLayoutItem.
Reimplemented in QMainWindowLayout, and QToolBarLayout.
Definition at line 673 of file qlayout.cpp.
Referenced by QStackedLayout::insertWidget(), QToolBarLayout::invalidate(), QBoxLayout::invalidate(), QGridLayout::invalidate(), QFormLayout::invalidate(), QMainWindowLayout::invalidate(), QLayout(), removeWidgetRecursively(), QWidget::setLayout(), QDockWidgetLayout::setVerticalTitleBar(), QWidget::setVisible(), QDockWidgetLayout::setWidgetForRole(), QDockWidgetLayout::takeAt(), QDockWidgetPrivate::updateButtons(), and QWidgetPrivate::updateGeometry_helper().
|
virtual |
Reimplemented Function
Implements QLayoutItem.
Reimplemented in QToolBarLayout.
Definition at line 639 of file qlayout.cpp.
bool QLayout::isEnabled | ( | ) | const |
Returns true if the layout is enabled; otherwise returns false.
Definition at line 1574 of file qlayout.cpp.
|
pure virtual |
Must be implemented in subclasses to return the layout item at index.
If there is no such item, the function must return 0. Items are numbered consecutively from 0. If an item is deleted, other items will be renumbered.
This function can be used to iterate over a layout. The following code will draw a rectangle for each layout item in the layout structure of the widget.
Implemented in QMainWindowLayout, QDockWidgetLayout, QFormLayout, QGridLayout, QBoxLayout, QStackedLayout, and QToolBarLayout.
Referenced by activateRecursiveHelper(), QGridLayout::addWidget(), changeSpacerSize(), QLayoutItem::controlTypes(), removeWidgetRecursively(), QAbstractScrollAreaScrollBarContainer::scrollBarLayoutIndex(), QToolBar::setIconSize(), QDeclarativeView::setRootObject(), and QAbstractScrollAreaScrollBarContainer::widgets().
|
virtual |
Reimplemented Function
Reimplemented from QLayoutItem.
Definition at line 360 of file qlayoutitem.cpp.
Referenced by QFormLayoutItem::layout(), QWidget::layout(), QToolBarLayout::setExpanded(), QBoxLayout::setStretchFactor(), and QMenuBarPrivate::updateCornerWidgetToolBar().
int QLayout::margin | ( | ) | const |
|
virtual |
Returns the maximum size of this layout.
This is the largest size that the layout can have while still respecting the specifications.
The returned value doesn't include the space required by QWidget::setContentsMargins() or menuBar().
The default implementation allows unlimited resizing.
Implements QLayoutItem.
Reimplemented in QDockWidgetLayout.
Definition at line 1181 of file qlayout.cpp.
Referenced by alignmentRect(), and QToolBarLayout::layoutActions().
QWidget * QLayout::menuBar | ( | ) | const |
Returns the menu bar set for this layout, or 0 if no menu bar is set.
Definition at line 1149 of file qlayout.cpp.
Referenced by QMainWindow::menuBar(), QMainWindow::menuWidget(), and QMainWindow::setMenuBar().
|
virtual |
Returns the minimum size of this layout.
This is the smallest size that the layout can have while still respecting the specifications.
The returned value doesn't include the space required by QWidget::setContentsMargins() or menuBar().
The default implementation allows unlimited resizing.
Implements QLayoutItem.
Reimplemented in QMainWindowLayout, QDockWidgetLayout, QToolBarLayout, and QStackedLayout.
Definition at line 1166 of file qlayout.cpp.
Referenced by QMdiSubWindow::minimumSizeHint().
QWidget * QLayout::parentWidget | ( | ) | const |
Returns the parent widget of this layout, or 0 if this layout is not installed on any widget.
If the layout is a sub-layout, this function returns the parent widget of the parent layout.
Definition at line 616 of file qlayout.cpp.
Referenced by QToolBarLayout::createItem(), QToolBarLayout::expandedSize(), QToolBarLayout::expandingDirections(), QMainWindowLayout::hover(), QToolBarLayout::layoutActions(), QDockWidgetLayout::maximumSize(), QDockWidgetLayout::minimumSize(), QDockWidgetLayout::minimumTitleWidth(), QToolBarLayout::movable(), QDockWidgetLayout::nativeWindowDeco(), parentWidget(), QMainWindowLayout::restoreState(), QStackedLayout::setCurrentIndex(), QToolBarLayout::setExpanded(), QToolBarLayout::setGeometry(), QBoxLayout::setGeometry(), QDockWidgetLayout::setGeometry(), QDockWidgetLayout::setVerticalTitleBar(), QDockWidgetLayout::sizeFromContent(), QDockWidgetLayout::sizeHint(), QMainWindowLayout::timerEvent(), QDockWidgetLayout::titleHeight(), QToolBarLayout::updateGeomArray(), and QToolBarLayout::updateMarginAndSpacing().
void QLayout::removeItem | ( | QLayoutItem * | item | ) |
Removes the layout item item from the layout.
It is the caller's responsibility to delete the item.
Notice that item can be a layout (since QLayout inherits QLayoutItem).
Definition at line 1539 of file qlayout.cpp.
void QLayout::removeWidget | ( | QWidget * | widget | ) |
Removes the widget widget from the layout.
After this call, it is the caller's responsibility to give the widget a reasonable geometry or to put the widget back into a layout.
Note: The ownership of widget remains the same as when it was added.
Definition at line 1516 of file qlayout.cpp.
Referenced by QToolBoxPrivate::_q_widgetDestroyed(), QMdiSubWindowPrivate::removeBaseWidget(), QAbstractScrollAreaPrivate::replaceScrollBar(), QMessageBox::setInformativeText(), QInputDialogPrivate::setInputWidget(), and QDockWidgetLayout::setWidgetForRole().
bool QLayout::setAlignment | ( | QWidget * | w, |
Qt::Alignment | alignment | ||
) |
Sets the alignment for widget w to alignment and returns true if w is found in this layout (not including child layouts); otherwise returns false.
Definition at line 332 of file qlayout.cpp.
Referenced by alignmentRect(), QPrintPreviewDialogPrivate::init(), and QMdiSubWindowPrivate::setSizeGrip().
bool QLayout::setAlignment | ( | QLayout * | l, |
Qt::Alignment | alignment | ||
) |
Sets the alignment for the layout l to alignment and returns true if l is found in this layout (not including child layouts); otherwise returns false.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 358 of file qlayout.cpp.
void QLayout::setContentsMargins | ( | int | left, |
int | top, | ||
int | right, | ||
int | bottom | ||
) |
Sets the left, top, right, and bottom margins to use around the layout.
By default, QLayout uses the values provided by the style. On most platforms, the margin is 11 pixels in all directions.
Definition at line 502 of file qlayout.cpp.
Referenced by QMainWindowPrivate::init(), QPrintPreviewDialogPrivate::init(), QPrintPreviewWidgetPrivate::init(), and QDialogButtonBoxPrivate::initLayout().
void QLayout::setContentsMargins | ( | const QMargins & | margins | ) |
Sets the margins to use around the layout.
By default, QLayout uses the values provided by the style. On most platforms, the margin is 11 pixels in all directions.
Definition at line 530 of file qlayout.cpp.
void QLayout::setEnabled | ( | bool | enable | ) |
Enables this layout if enable is true, otherwise disables it.
An enabled layout adjusts dynamically to changes; a disabled layout acts as if it did not exist.
By default all layouts are enabled.
Definition at line 1563 of file qlayout.cpp.
Referenced by QDialog::showExtension().
|
virtual |
Reimplemented Function
Implements QLayoutItem.
Reimplemented in QMainWindowLayout, QDockWidgetLayout, QFormLayout, QGridLayout, QBoxLayout, QStackedLayout, and QToolBarLayout.
Definition at line 655 of file qlayout.cpp.
Referenced by QGridLayout::addWidget(), QToolBarLayout::setGeometry(), QBoxLayout::setGeometry(), QGridLayout::setGeometry(), QFormLayout::setGeometry(), and QMainWindowLayout::setGeometry().
void QLayout::setMargin | ( | int | margin | ) |
Definition at line 464 of file qlayout.cpp.
Referenced by QCalendarWidgetPrivate::createNavigationBar(), QWorkspaceChild::iconWidget(), QPrintPreviewDialogPrivate::init(), QMessageBoxPrivate::init(), QAbstractScrollAreaScrollBarContainer::QAbstractScrollAreaScrollBarContainer(), QBalloonTip::QBalloonTip(), QBoxLayout::QBoxLayout(), QCalendarWidget::QCalendarWidget(), QColorShower::QColorShower(), QComboBoxPrivateContainer::QComboBoxPrivateContainer(), QGridLayout::QGridLayout(), QHBoxLayout::QHBoxLayout(), QMdiSubWindow::QMdiSubWindow(), QMessageBoxDetailsText::QMessageBoxDetailsText(), QScriptBreakpointsWidget::QScriptBreakpointsWidget(), QScriptDebuggerCodeFinderWidget::QScriptDebuggerCodeFinderWidget(), QScriptDebuggerCodeView::QScriptDebuggerCodeView(), QScriptDebuggerCodeWidget::QScriptDebuggerCodeWidget(), QScriptDebuggerConsoleWidget::QScriptDebuggerConsoleWidget(), QScriptDebuggerLocalsWidget::QScriptDebuggerLocalsWidget(), QScriptDebuggerScriptsWidget::QScriptDebuggerScriptsWidget(), QScriptDebuggerStackWidget::QScriptDebuggerStackWidget(), QScriptDebugOutputWidget::QScriptDebugOutputWidget(), QScriptErrorLogWidget::QScriptErrorLogWidget(), QScriptNewBreakpointWidget::QScriptNewBreakpointWidget(), QVBoxLayout::QVBoxLayout(), QWizardHeader::QWizardHeader(), QToolBoxPrivate::relayout(), QCalendarPopup::setCalendarWidget(), QScriptEngineDebugger::standardWindow(), QCoreFuriCuri::timerEvent(), and QToolBarLayout::updateMarginAndSpacing().
void QLayout::setMenuBar | ( | QWidget * | widget | ) |
Tells the geometry manager to place the menu bar widget at the top of parentWidget(), outside QWidget::contentsMargins().
All child widgets are placed below the bottom edge of the menu bar.
Definition at line 1131 of file qlayout.cpp.
Referenced by QMainWindow::setMenuBar().
void QLayout::setSizeConstraint | ( | SizeConstraint | constraint | ) |
Definition at line 1435 of file qlayout.cpp.
Referenced by QInputDialogPrivate::ensureLayout(), QColorDialogPrivate::init(), QDockWidgetPrivate::init(), QMessageBoxPrivate::init(), and QBalloonTip::QBalloonTip().
void QLayout::setSpacing | ( | int | spacing | ) |
Definition at line 469 of file qlayout.cpp.
Referenced by QAbstractScrollAreaScrollBarContainer::QAbstractScrollAreaScrollBarContainer(), QWizardHeader::QWizardHeader(), and QToolBarLayout::updateMarginAndSpacing().
SizeConstraint QLayout::sizeConstraint | ( | ) | const |
Referenced by setSizeConstraint().
int QLayout::spacing | ( | ) | const |
|
pure virtual |
Must be implemented in subclasses to remove the layout item at index from the layout, and return the item.
If there is no such item, the function must do nothing and return 0. Items are numbered consecutively from 0. If an item is removed, other items will be renumbered.
The following code fragment shows a safe way to remove all items from a layout:
Implemented in QMainWindowLayout, QDockWidgetLayout, QFormLayout, QGridLayout, QBoxLayout, QStackedLayout, and QToolBarLayout.
Referenced by QGridLayout::addWidget(), removeWidgetRecursively(), and QMenuBarPrivate::updateCornerWidgetToolBar().
int QLayout::totalHeightForWidth | ( | int | w | ) | const |
Also takes contentsMargins and menu bar into account.
Definition at line 823 of file qlayout.cpp.
Referenced by QWidgetPrivate::adjustedSize(), QWidget::heightForWidth(), and QMessageBoxPrivate::updateSize().
QSize QLayout::totalMaximumSize | ( | ) | const |
Also takes contentsMargins and menu bar into account.
Definition at line 902 of file qlayout.cpp.
QSize QLayout::totalMinimumSize | ( | ) | const |
Also takes contentsMargins and menu bar into account.
Definition at line 848 of file qlayout.cpp.
Referenced by QMessageBoxPrivate::layoutMinimumWidth(), QWizardHeader::setup(), and QMessageBoxPrivate::updateSize().
QSize QLayout::totalSizeHint | ( | ) | const |
Also takes contentsMargins and menu bar into account.
Definition at line 874 of file qlayout.cpp.
void QLayout::update | ( | ) |
Updates the layout for parentWidget().
You should generally not need to call this because it is automatically called at the most appropriate times.
Definition at line 1225 of file qlayout.cpp.
Referenced by QMainWindowPrivate::adjustCursor(), and QX11EmbedWidget::resizeEvent().
|
protected |
Performs child widget layout when the parent widget is resized.
Definition at line 726 of file qlayout.cpp.
|
friend |
|
private |
the width of the outside border of the layout
Use setContentsMargins() and getContentsMargins() instead.
Definition at line 96 of file qlayout.h.
Referenced by QCommonStyle::subElementRect().
|
private |
the resize mode of the layout
The default mode is QLayout::SetDefaultConstraint {SetDefaultConstraint}.
|
private |
the spacing between widgets inside the layout
If no value is explicitly set, the layout's spacing is inherited from the parent layout, or from the style settings for the parent widget.
For QGridLayout and QFormLayout, it is possible to set different horizontal and vertical spacings using QGridLayout::setHorizontalSpacing() and QGridLayout::setVerticalSpacing(). In that case, spacing() returns -1.