![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
The QGridLayout class lays out widgets in a grid. More...
#include <qgridlayout.h>
Public Member Functions | |
QGridLayout (QWidget *parent=nullptr) | |
Constructs a new QGridLayout with parent widget, parent. | |
~QGridLayout () | |
Destroys the grid layout. | |
QSize | sizeHint () const override |
\reimp | |
QSize | minimumSize () const override |
\reimp | |
QSize | maximumSize () const override |
\reimp | |
void | setHorizontalSpacing (int spacing) |
int | horizontalSpacing () const |
the spacing between widgets that are laid out side by side | |
void | setVerticalSpacing (int spacing) |
int | verticalSpacing () const |
the spacing between widgets that are laid out on top of each other | |
void | setSpacing (int spacing) override |
This function sets both the vertical and horizontal spacing to spacing. | |
int | spacing () const override |
If the vertical spacing is equal to the horizontal spacing, this function returns that value; otherwise it return -1. | |
void | setRowStretch (int row, int stretch) |
Sets the stretch factor of row row to stretch. | |
void | setColumnStretch (int column, int stretch) |
Sets the stretch factor of column column to stretch. | |
int | rowStretch (int row) const |
Returns the stretch factor for row row. | |
int | columnStretch (int column) const |
Returns the stretch factor for column column. | |
void | setRowMinimumHeight (int row, int minSize) |
Sets the minimum height of row row to minSize pixels. | |
void | setColumnMinimumWidth (int column, int minSize) |
Sets the minimum width of column column to minSize pixels. | |
int | rowMinimumHeight (int row) const |
Returns the minimum width set for row row. | |
int | columnMinimumWidth (int column) const |
Returns the column spacing for column column. | |
int | columnCount () const |
Returns the number of columns in this grid. | |
int | rowCount () const |
Returns the number of rows in this grid. | |
QRect | cellRect (int row, int column) const |
Returns the geometry of the cell with row row and column column in the grid. | |
bool | hasHeightForWidth () const override |
\reimp | |
int | heightForWidth (int) const override |
\reimp | |
int | minimumHeightForWidth (int) const override |
\reimp | |
Qt::Orientations | expandingDirections () const override |
\reimp | |
void | invalidate () override |
\reimp | |
void | addWidget (QWidget *w) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | addWidget (QWidget *, int row, int column, Qt::Alignment=Qt::Alignment()) |
Adds the given widget to the cell grid at row, column. | |
void | addWidget (QWidget *, int row, int column, int rowSpan, int columnSpan, Qt::Alignment=Qt::Alignment()) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This version adds the given widget to the cell grid, spanning multiple rows/columns. | |
void | addLayout (QLayout *, int row, int column, Qt::Alignment=Qt::Alignment()) |
Places the layout at position (row, column) in the grid. | |
void | addLayout (QLayout *, int row, int column, int rowSpan, int columnSpan, Qt::Alignment=Qt::Alignment()) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This version adds the layout layout to the cell grid, spanning multiple rows/columns. | |
void | setOriginCorner (Qt::Corner) |
Sets the grid's origin corner, i.e. | |
Qt::Corner | originCorner () const |
Returns the corner that's used for the grid's origin, i.e. | |
QLayoutItem * | itemAt (int index) const override |
\reimp | |
QLayoutItem * | itemAtPosition (int row, int column) const |
QLayoutItem * | takeAt (int index) override |
\reimp | |
int | count () const override |
\reimp | |
void | setGeometry (const QRect &) override |
\reimp | |
void | addItem (QLayoutItem *item, int row, int column, int rowSpan=1, int columnSpan=1, Qt::Alignment=Qt::Alignment()) |
Adds item at position row, column, spanning rowSpan rows and columnSpan columns, and aligns it according to alignment. | |
void | setDefaultPositioning (int n, Qt::Orientation orient) |
void | getItemPosition (int idx, int *row, int *column, int *rowSpan, int *columnSpan) const |
Returns the position information of the item with the given index. | |
![]() | |
QLayout (QWidget *parent=nullptr) | |
Constructs a new top-level QLayout, with parent parent. | |
~QLayout () | |
void | setContentsMargins (int left, int top, int right, int bottom) |
void | setContentsMargins (const QMargins &margins) |
void | unsetContentsMargins () |
void | getContentsMargins (int *left, int *top, int *right, int *bottom) const |
QMargins | contentsMargins () const |
QRect | contentsRect () const |
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 . | |
bool | setAlignment (QLayout *l, Qt::Alignment alignment) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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 . | |
void | setSizeConstraint (SizeConstraint) |
SizeConstraint | sizeConstraint () const |
void | setMenuBar (QWidget *w) |
Tells the geometry manager to place the menu bar widget at the top of parentWidget(), outside QWidget::contentsMargins(). | |
QWidget * | menuBar () const |
Returns the menu bar set for this layout, or \nullptr if no menu bar is set. | |
QWidget * | parentWidget () const |
Returns the parent widget of this layout, or \nullptr if this layout is not installed on any widget. | |
void | invalidate () override |
\reimp | |
QRect | geometry () const override |
\reimp | |
bool | activate () |
Redoes the layout for parentWidget() if necessary. | |
void | update () |
Updates the layout for parentWidget(). | |
void | addWidget (QWidget *w) |
Adds widget w to this layout in a manner specific to the layout. | |
void | removeWidget (QWidget *w) |
Removes the widget widget from the layout. | |
void | removeItem (QLayoutItem *) |
Removes the layout item item from the layout. | |
Qt::Orientations | expandingDirections () const override |
Returns whether this layout can make use of more space than sizeHint(). | |
QSize | minimumSize () const override |
Returns the minimum size of this layout. | |
QSize | maximumSize () const override |
Returns the maximum size of this layout. | |
virtual int | indexOf (const QWidget *) const |
Searches for widget widget in this layout (not including child layouts). | |
virtual int | indexOf (const QLayoutItem *) const |
bool | isEmpty () const override |
\reimp | |
QSizePolicy::ControlTypes | controlTypes () const override |
\reimp | |
virtual QLayoutItem * | replaceWidget (QWidget *from, QWidget *to, Qt::FindChildOptions options=Qt::FindChildrenRecursively) |
int | totalMinimumHeightForWidth (int w) const |
int | totalHeightForWidth (int w) const |
QSize | totalMinimumSize () const |
QSize | totalMaximumSize () const |
QSize | totalSizeHint () const |
QLayout * | layout () override |
\reimp | |
void | setEnabled (bool) |
Enables this layout if enable is true, otherwise disables it. | |
bool | isEnabled () const |
Returns true if the layout is enabled; otherwise returns false . | |
void | setAlignment (Qt::Alignment a) |
Sets the alignment of this item to alignment. | |
![]() | |
Q_INVOKABLE | QObject (QObject *parent=nullptr) |
Constructs an object with parent object parent. | |
virtual | ~QObject () |
Destroys the object, deleting all its child objects. | |
virtual bool | event (QEvent *event) |
This virtual function receives events to an object and should return true if the event e was recognized and processed. | |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
Filters events if this object has been installed as an event filter for the watched object. | |
QString | objectName () const |
Q_WEAK_OVERLOAD void | setObjectName (const QString &name) |
Sets the object's name to name. | |
void | setObjectName (QAnyStringView name) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QBindable< QString > | bindableObjectName () |
bool | isWidgetType () const |
Returns true if the object is a widget; otherwise returns false . | |
bool | isWindowType () const |
Returns true if the object is a window; otherwise returns false . | |
bool | isQuickItemType () const |
Returns true if the object is a QQuickItem; otherwise returns false . | |
bool | signalsBlocked () const noexcept |
Returns true if signals are blocked; otherwise returns false . | |
bool | blockSignals (bool b) noexcept |
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). | |
QThread * | thread () const |
Returns the thread in which the object lives. | |
bool | moveToThread (QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL) |
Changes the thread affinity for this object and its children and returns true on success. | |
int | startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer) |
This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds. | |
int | startTimer (std::chrono::nanoseconds time, Qt::TimerType timerType=Qt::CoarseTimer) |
void | killTimer (int id) |
Kills the timer with timer identifier, id. | |
void | killTimer (Qt::TimerId id) |
template<typename T> | |
T | findChild (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object. | |
template<typename T> | |
QList< T > | findChildren (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) 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. | |
template<typename T> | |
T | findChild (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
template<typename T> | |
QList< T > | findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const QObjectList & | children () const |
Returns a list of child objects. | |
void | setParent (QObject *parent) |
Makes the object a child of parent. | |
void | installEventFilter (QObject *filterObj) |
Installs an event filter filterObj on this object. | |
void | removeEventFilter (QObject *obj) |
Removes an event filter object obj from this object. | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const |
bool | disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const |
bool | disconnect (const QObject *receiver, const char *member=nullptr) const |
void | dumpObjectTree () const |
Dumps a tree of children to the debug output. | |
void | dumpObjectInfo () const |
Dumps information about signal connections, etc. | |
bool | setProperty (const char *name, const QVariant &value) |
Sets the value of the object's name property to value. | |
bool | setProperty (const char *name, QVariant &&value) |
QVariant | property (const char *name) const |
Returns the value of the object's name property. | |
QList< QByteArray > | dynamicPropertyNames () const |
QBindingStorage * | bindingStorage () |
const QBindingStorage * | bindingStorage () const |
QObject * | parent () const |
Returns a pointer to the parent object. | |
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 . | |
![]() | |
QLayoutItem (Qt::Alignment alignment=Qt::Alignment()) | |
Constructs a layout item with an alignment. | |
virtual | ~QLayoutItem () |
Destroys the QLayoutItem. | |
virtual QWidget * | widget () const |
If this item manages a QWidget, returns that widget. | |
virtual QSpacerItem * | spacerItem () |
If this item is a QSpacerItem, it is returned as a QSpacerItem; otherwise \nullptr is returned. | |
Qt::Alignment | alignment () const |
Returns the alignment of this item. | |
void | setAlignment (Qt::Alignment a) |
Sets the alignment of this item to alignment. | |
Protected Member Functions | |
void | addItem (QLayoutItem *) override |
\reimp | |
![]() | |
void | widgetEvent (QEvent *) |
void | childEvent (QChildEvent *e) override |
\reimp | |
void | addChildLayout (QLayout *l) |
This function is called from addLayout() or insertLayout() functions in subclasses to add layout childLayout as a sub-layout. | |
void | addChildWidget (QWidget *w) |
This function is called from addWidget() functions in subclasses to add w as a managed widget of a layout. | |
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(). | |
QLayout (QLayoutPrivate &d, QLayout *, QWidget *) | |
![]() | |
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 \nullptr. | |
int | senderSignalIndex () const |
int | receivers (const char *signal) const |
Returns the number of receivers connected to the signal. | |
bool | isSignalConnected (const QMetaMethod &signal) const |
virtual void | timerEvent (QTimerEvent *event) |
This event handler can be reimplemented in a subclass to receive timer events for the object. | |
virtual void | customEvent (QEvent *event) |
This event handler can be reimplemented in a subclass to receive custom events. | |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
QObject (QObjectPrivate &dd, QObject *parent=nullptr) | |
Additional Inherited Members | |
![]() | |
enum | SizeConstraint { SetDefaultConstraint , SetNoConstraint , SetMinimumSize , SetFixedSize , SetMaximumSize , SetMinAndMaxSize } |
The possible values are: More... | |
![]() | |
void | deleteLater () |
\threadsafe | |
![]() | |
void | destroyed (QObject *=nullptr) |
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked. | |
void | objectNameChanged (const QString &objectName, QPrivateSignal) |
This signal is emitted after the object's name has been changed. | |
![]() | |
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. | |
![]() | |
static QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection) |
\threadsafe | |
static QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1, typename Func2> | |
static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1, typename Func2> | |
static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot) |
static bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member) |
\threadsafe | |
static bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member) |
static bool | disconnect (const QMetaObject::Connection &) |
Disconnect a connection. | |
template<typename Func1, typename Func2> | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot) |
template<typename Func1> | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero) |
![]() | |
QScopedPointer< QObjectData > | d_ptr |
![]() | |
Qt::Alignment | align |
![]() | |
int | spacing |
the spacing between widgets inside the layout | |
QMargins | contentsMargins |
SizeConstraint | sizeConstraint |
the resize mode of the layout | |
![]() | |
QString | objectName |
the name of this object | |
![]() | |
template< class T > T | qobject_cast (const QObject *object) |
Returns the given object cast to type T if the object is of type T (or of a subclass); otherwise returns \nullptr. | |
template< typename T > T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
template< typename T > QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QObjectList | |
\macro Q_CLASSINFO(Name, Value) | |
The QGridLayout class lays out widgets in a grid.
\inmodule QtWidgets
QGridLayout takes the space made available to it (by its parent layout or by the parentWidget()), divides it up into rows and columns, and puts each widget it manages into the correct cell.
Columns and rows behave identically; we will discuss columns, but there are equivalent functions for rows.
Each column has a minimum width and a stretch factor. The minimum width is the greatest of that set using setColumnMinimumWidth() and the minimum width of each widget in that column. The stretch factor is set using setColumnStretch() and determines how much of the available space the column will get over and above its necessary minimum.
Normally, each managed widget or layout is put into a cell of its own using addWidget(). It is also possible for a widget to occupy multiple cells using the row and column spanning overloads of addItem() and addWidget(). If you do this, QGridLayout will guess how to distribute the size over the columns/rows (based on the stretch factors).
To remove a widget from a layout, call removeWidget(). Calling QWidget::hide() on a widget also effectively removes the widget from the layout until QWidget::show() is called.
This illustration shows a fragment of a dialog with a five-column, three-row grid (the grid is shown overlaid in magenta):
A grid layout
Columns 0, 2 and 4 in this dialog fragment are made up of a QLabel, a QLineEdit, and a QListBox. Columns 1 and 3 are placeholders made with setColumnMinimumWidth(). Row 0 consists of three QLabel objects, row 1 of three QLineEdit objects and row 2 of three QListBox objects. We used placeholder columns (1 and 3) to get the right amount of space between the columns.
Note that the columns and rows are not equally wide or tall. If you want two columns to have the same width, you must set their minimum widths and stretch factors to be the same yourself. You do this using setColumnMinimumWidth() and setColumnStretch().
If the QGridLayout is not the top-level layout (i.e. does not manage all of the widget's area and children), you must add it to its parent layout when you create it, but before you do anything with it. The normal way to add a layout is by calling addLayout() on the parent layout.
Once you have added your layout you can start putting widgets and other layouts into the cells of your grid layout using addWidget(), addItem(), and addLayout().
QGridLayout also includes two margin widths: the \l{getContentsMargins()}{contents margin} and the spacing(). The contents margin is the width of the reserved space along each of the QGridLayout's four sides. The spacing() is the width of the automatically allocated spacing between neighboring boxes.
The default contents margin values are provided by the \l{QStyle::pixelMetric()}{style}. The default value Qt styles specify is 9 for child widgets and 11 for windows. The spacing defaults to the same as the margin width for a top-level layout, or to the same as the parent layout.
Definition at line 20 of file qgridlayout.h.
|
explicit |
Constructs a new QGridLayout with parent widget, parent.
The layout has one row and one column initially, and will expand when new items are inserted.
The layout is set directly as the top-level layout for parent. There can be only one top-level layout for a widget. It is returned by QWidget::layout().
If parent is \nullptr, then you must insert this grid layout into another layout, or set it as a widget's layout using QWidget::setLayout().
Definition at line 1050 of file qgridlayout.cpp.
QGridLayout::~QGridLayout | ( | ) |
Destroys the grid layout.
Geometry management is terminated if this is a top-level grid.
The layout's widgets aren't destroyed.
Definition at line 1085 of file qgridlayout.cpp.
|
overrideprotectedvirtual |
void QGridLayout::addItem | ( | QLayoutItem * | item, |
int | row, | ||
int | column, | ||
int | rowSpan = 1, | ||
int | columnSpan = 1, | ||
Qt::Alignment | alignment = Qt::Alignment() ) |
Adds item at position row, column, spanning rowSpan rows and columnSpan columns, and aligns it according to alignment.
If rowSpan and/or columnSpan is -1, then the item will extend to the bottom and/or right edge, respectively. The layout takes ownership of the item.
Definition at line 1382 of file qgridlayout.cpp.
void QGridLayout::addLayout | ( | QLayout * | layout, |
int | row, | ||
int | column, | ||
int | rowSpan, | ||
int | columnSpan, | ||
Qt::Alignment | alignment = Qt::Alignment() ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. This version adds the layout layout to the cell grid, spanning multiple rows/columns.
The cell will start at row, column spanning rowSpan rows and columnSpan columns.
If rowSpan and/or columnSpan is -1, then the layout will extend to the bottom and/or right edge, respectively.
Definition at line 1484 of file qgridlayout.cpp.
void QGridLayout::addLayout | ( | QLayout * | layout, |
int | row, | ||
int | column, | ||
Qt::Alignment | alignment = Qt::Alignment() ) |
Places the layout at position (row, column) in the grid.
The top-left position is (0, 0).
The alignment is specified by alignment. The default alignment is 0, which means that the widget fills the entire cell.
A non-zero alignment indicates that the layout should not grow to fill the available space but should be sized according to sizeHint().
layout becomes a child of the grid layout.
Definition at line 1463 of file qgridlayout.cpp.
void QGridLayout::addWidget | ( | QWidget * | widget, |
int | fromRow, | ||
int | fromColumn, | ||
int | rowSpan, | ||
int | columnSpan, | ||
Qt::Alignment | alignment = Qt::Alignment() ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This version adds the given widget to the cell grid, spanning multiple rows/columns.
The cell will start at fromRow, fromColumn spanning rowSpan rows and columnSpan columns. The widget will have the given alignment.
If rowSpan and/or columnSpan is -1, then the widget will extend to the bottom and/or right edge, respectively.
Definition at line 1427 of file qgridlayout.cpp.
void QGridLayout::addWidget | ( | QWidget * | widget, |
int | row, | ||
int | column, | ||
Qt::Alignment | alignment = Qt::Alignment() ) |
Adds the given widget to the cell grid at row, column.
The top-left position is (0, 0) by default.
The alignment is specified by alignment. The default alignment is 0, which means that the widget fills the entire cell.
Definition at line 1399 of file qgridlayout.cpp.
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 64 of file qgridlayout.h.
QRect QGridLayout::cellRect | ( | int | row, |
int | column ) const |
Returns the geometry of the cell with row row and column column in the grid.
Returns an invalid rectangle if row or column is outside the grid.
Definition at line 1355 of file qgridlayout.cpp.
int QGridLayout::columnCount | ( | ) | const |
Returns the number of columns in this grid.
Definition at line 1188 of file qgridlayout.cpp.
int QGridLayout::columnMinimumWidth | ( | int | column | ) | const |
Returns the column spacing for column column.
Definition at line 1605 of file qgridlayout.cpp.
int QGridLayout::columnStretch | ( | int | column | ) | const |
Returns the stretch factor for column column.
Definition at line 1533 of file qgridlayout.cpp.
|
overridevirtual |
|
overridevirtual |
void QGridLayout::getItemPosition | ( | int | index, |
int * | row, | ||
int * | column, | ||
int * | rowSpan, | ||
int * | columnSpan ) const |
Returns the position information of the item with the given index.
The variables passed as row and column are updated with the position of the item in the layout, and the rowSpan and columnSpan variables are updated with the vertical and horizontal spans of the item.
Definition at line 1326 of file qgridlayout.cpp.
|
overridevirtual |
|
overridevirtual |
int QGridLayout::horizontalSpacing | ( | ) | const |
the spacing between widgets that are laid out side by side
If no value is explicitly set, the layout's horizontal spacing is inherited from the parent layout, or from the style settings for the parent widget.
Definition at line 1109 of file qgridlayout.cpp.
|
overridevirtual |
|
overridevirtual |
QLayoutItem * QGridLayout::itemAtPosition | ( | int | row, |
int | column ) const |
Returns the layout item that occupies cell (row, column), or \nullptr if the cell is empty.
Definition at line 1294 of file qgridlayout.cpp.
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
Qt::Corner QGridLayout::originCorner | ( | ) | const |
Returns the corner that's used for the grid's origin, i.e.
for position (0, 0).
Definition at line 1634 of file qgridlayout.cpp.
int QGridLayout::rowCount | ( | ) | const |
Returns the number of rows in this grid.
Definition at line 1179 of file qgridlayout.cpp.
int QGridLayout::rowMinimumHeight | ( | int | row | ) | const |
Returns the minimum width set for row row.
Definition at line 1582 of file qgridlayout.cpp.
int QGridLayout::rowStretch | ( | int | row | ) | const |
Returns the stretch factor for row row.
Definition at line 1522 of file qgridlayout.cpp.
void QGridLayout::setColumnMinimumWidth | ( | int | column, |
int | minSize ) |
Sets the minimum width of column column to minSize pixels.
Definition at line 1593 of file qgridlayout.cpp.
void QGridLayout::setColumnStretch | ( | int | column, |
int | stretch ) |
Sets the stretch factor of column column to stretch.
The first column is number 0.
The stretch factor is relative to the other columns in this grid. Columns with a higher stretch factor take more of the available space.
The default stretch factor is 0. If the stretch factor is 0 and no other column in this table can grow at all, the column may still grow.
An alternative approach is to add spacing using addItem() with a QSpacerItem.
Definition at line 1556 of file qgridlayout.cpp.
void QGridLayout::setDefaultPositioning | ( | int | n, |
Qt::Orientation | orient ) |
(mostly)
Sets the positioning mode used by addItem(). If orient is Qt::Horizontal, this layout is expanded to n columns, and items will be added columns-first. Otherwise it is expanded to n rows and items will be added rows-first.
Definition at line 1066 of file qgridlayout.cpp.
void QGridLayout::setHorizontalSpacing | ( | int | spacing | ) |
Definition at line 1102 of file qgridlayout.cpp.
void QGridLayout::setOriginCorner | ( | Qt::Corner | corner | ) |
Sets the grid's origin corner, i.e.
position (0, 0), to corner.
Definition at line 1623 of file qgridlayout.cpp.
void QGridLayout::setRowMinimumHeight | ( | int | row, |
int | minSize ) |
Sets the minimum height of row row to minSize pixels.
Definition at line 1570 of file qgridlayout.cpp.
void QGridLayout::setRowStretch | ( | int | row, |
int | stretch ) |
Sets the stretch factor of row row to stretch.
The first row is number 0.
The stretch factor is relative to the other rows in this grid. Rows with a higher stretch factor take more of the available space.
The default stretch factor is 0. If the stretch factor is 0 and no other row in this table can grow at all, the row may still grow.
Definition at line 1510 of file qgridlayout.cpp.
|
overridevirtual |
This function sets both the vertical and horizontal spacing to spacing.
Reimplemented from QLayout.
Definition at line 1153 of file qgridlayout.cpp.
void QGridLayout::setVerticalSpacing | ( | int | spacing | ) |
Definition at line 1130 of file qgridlayout.cpp.
|
overridevirtual |
|
overridevirtual |
If the vertical spacing is equal to the horizontal spacing, this function returns that value; otherwise it return -1.
Reimplemented from QLayout.
Definition at line 1166 of file qgridlayout.cpp.
|
overridevirtual |
int QGridLayout::verticalSpacing | ( | ) | const |
the spacing between widgets that are laid out on top of each other
If no value is explicitly set, the layout's vertical spacing is inherited from the parent layout, or from the style settings for the parent widget.
Definition at line 1137 of file qgridlayout.cpp.