|  | Home · All Classes · Main Classes · Annotated · Grouped Classes · Functions |

# QGridWidget Class Reference

The QGridWidget class provides simple geometry management of its children. More...

    #include <QGridWidget>

Part of the QtGui module.

Inherits QFrame.

- List of all members, including inherited members
- Qt 3 support members

### Public Types

- typedef Direction

### Public Functions

- QGridWidget ( int n, QWidget * parent = 0, Qt::WFlags f = 0 )
- QGridWidget ( int n, Qt::Orientation orientation, QWidget * parent = 0, Qt::WFlags f = 0 )
- void setMargin ( int margin )
- void setSpacing ( int spacing )

- 13 public functions inherited from QFrame
- 182 public functions inherited from QWidget
- 28 public functions inherited from QObject
- 11 public functions inherited from QPaintDevice

### Additional Inherited Members

- 6 properties inherited from QFrame
- 51 properties inherited from QWidget
- 1 property inherited from QObject
- 17 public slots inherited from QWidget
- 1 public slot inherited from QObject
- 1 signal inherited from QWidget
- 1 signal inherited from QObject
- 4 static public members inherited from QWidget
- 4 static public members inherited from QObject
- 37 protected functions inherited from QWidget
- 7 protected functions inherited from QObject

## Detailed Description

The QGridWidget class provides simple geometry management of its children.

The grid places its widgets either in columns or in rows depending on its orientation.

The number of rows or columns is defined in the constructor. All the grid's children will be placed and sized in accordance with their sizeHint() and sizePolicy().

Use setMargin() to add space around the grid itself, and setSpacing() to add space between the widgets.

If you just need a layout (not a widget) use QGridLayout instead.

See also QVBoxWidget and QHBoxWidget.

## Member Type Documentation

### typedef QGridWidget::Direction

## Member Function Documentation

### QGridWidget::QGridWidget ( int n, QWidget * parent = 0, Qt::WFlags f = 0 )

Constructs a grid widget with parent parent. n specifies the number of columns. The widget flags f are passed to the QFrame constructor.

### QGridWidget::QGridWidget ( int n, Qt::Orientation orientation, QWidget * parent = 0, Qt::WFlags f = 0 )

Constructs a grid widget with parent parent. If orientation is `Qt::Horizontal`, n specifies the number of columns. If orientation is `Qt::Vertical`, n specifies the number of rows. The widget flags f are passed to the QFrame constructor.

### void QGridWidget::setMargin ( int margin )

Sets the margin around the grid to margin (expressed in pixels).

See also setSpacing().

### void QGridWidget::setSpacing ( int spacing )

Sets the spacing between the child widgets to spacing (expressed in pixels).

See also setMargin().