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

# Q3GroupBox Class Reference

The Q3GroupBox widget provides a group box frame with a title. More...

    #include <Q3GroupBox>

This class is part of the Qt 3 support library. It is provided to keep old source code working. We strongly advise against using it in new code. See the Porting Guide for more information.

Part of the Qt3Support module.

Inherits Q3Frame.

Inherited by Q3ButtonGroup.

- List of all members, including inherited members

### Properties

- alignment : Qt::Alignment
- checkable : bool
- checked : bool
- columns : int

- flat : bool
- orientation : Qt::Orientation
- title : QString

- 2 properties inherited from Q3Frame
- 6 properties inherited from QFrame
- 51 properties inherited from QWidget
- 1 property inherited from QObject

### Public Functions

- Q3GroupBox ( QWidget * parent = 0, const char * name = 0 )
- Q3GroupBox ( const QString & title, QWidget * parent = 0, const char * name = 0 )
- Q3GroupBox ( int strips, Qt::Orientation orientation, QWidget * parent = 0, const char * name = 0 )
- Q3GroupBox ( int strips, Qt::Orientation orientation, const QString & title, QWidget * parent = 0, const char * name = 0 )
- ~Q3GroupBox ()
- void addSpace ( int size )
- int alignment () const
- int columns () const
- int insideMargin () const
- int insideSpacing () const
- bool isCheckable () const
- bool isChecked () const
- bool isFlat () const
- Qt::Orientation orientation () const
- virtual void setAlignment ( int )
- void setCheckable ( bool b )
- virtual void setColumnLayout ( int strips, Qt::Orientation direction )
- void setColumns ( int )
- void setFlat ( bool b )
- void setInsideMargin ( int m )
- void setInsideSpacing ( int s )
- void setOrientation ( Qt::Orientation )
- virtual void setTitle ( const QString & )
- QString title () const

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

### Public Slots

- void setChecked ( bool b )

- 17 public slots inherited from QWidget
- 1 public slot inherited from QObject

### Signals

- void toggled ( bool on )

- 1 signal inherited from QWidget
- 1 signal inherited from QObject

### Additional Inherited Members

- 4 static public members inherited from QWidget
- 4 static public members inherited from QObject
- 5 protected functions inherited from Q3Frame
- 37 protected functions inherited from QWidget
- 7 protected functions inherited from QObject

## Detailed Description

The Q3GroupBox widget provides a group box frame with a title.

A group box provides a frame, a title and a keyboard shortcut, and displays various other widgets inside itself. The title is on top, the keyboard shortcut moves keyboard focus to one of the group box's child widgets, and the child widgets are usually laid out horizontally (or vertically) inside the frame.

The simplest way to use it is to create a group box with the desired number of columns (or rows) and orientation, and then just create widgets with the group box as parent.

It is also possible to change the orientation() and number of columns() after construction, or to ignore all the automatic layout support and manage the layout yourself. You can add 'empty' spaces to the group box with addSpace().

Q3GroupBox also lets you set the title() (normally set in the constructor) and the title's alignment().

You can change the spacing used by the group box with setInsideMargin() and setInsideSpacing(). To minimize space consumption, you can remove the right, left and bottom edges of the frame with setFlat().

See also QButtonGroup.

## Property Documentation

### alignment : Qt::Alignment

This property holds the alignment of the group box title.

The title is always placed on the upper frame line. The horizontal alignment can be specified by the alignment parameter.

The alignment is one of the following flags:

- `Qt::AlignAuto` aligns the title according to the language, usually to the left.
- `Qt::AlignLeft` aligns the title text to the left.
- `Qt::AlignRight` aligns the title text to the right.
- `Qt::AlignHCenter` aligns the title text centered.

The default alignment is `Qt::AlignAuto`.

Access functions:

- int alignment () const
- virtual void setAlignment ( int )

See also Qt::Alignment.

### checkable : bool

This property holds whether the group box has a checkbox in its title.

If this property is true, the group box has a checkbox. If the checkbox is checked (which is the default), the group box's children are enabled.

setCheckable() controls whether or not the group box has a checkbox, and isCheckable() controls whether the checkbox is checked or not.

Access functions:

- bool isCheckable () const
- void setCheckable ( bool b )

### checked : bool

This property holds whether the group box's checkbox is checked.

If the checkbox is unchecked the children are disabled.

Access functions:

- bool isChecked () const
- void setChecked ( bool b )

### columns : int

This property holds the number of columns or rows (depending on Q3GroupBox::orientation) in the group box.

Usually it is not a good idea to set this property because it is slow (it does a complete layout). It is best to set the number of columns directly in the constructor.

Access functions:

- int columns () const
- void setColumns ( int )

### flat : bool

This property holds whether the group box is painted flat or has a frame.

By default a group box has a surrounding frame, with the title being placed on the upper frame line. In flat mode the right, left and bottom frame lines are omitted, and only the thin line at the top is drawn.

Access functions:

- bool isFlat () const
- void setFlat ( bool b )

See also title.

### orientation : Qt::Orientation

This property holds the group box's orientation.

A horizontal group box arranges it's children in columns, while a vertical group box arranges them in rows.

Usually it is not a good idea to set this property because it is slow (it does a complete layout). It is better to set the orientation directly in the constructor.

Access functions:

- Qt::Orientation orientation () const
- void setOrientation ( Qt::Orientation )

### title : QString

This property holds the group box title text.

The group box title text will have a focus-change keyboard accelerator if the title contains &, followed by a letter.

        g->setTitle("&User information");

This produces "<u>U</u>ser information"; Alt+U moves the keyboard focus to the group box.

There is no default title text.

Access functions:

- QString title () const
- virtual void setTitle ( const QString & )

## Member Function Documentation

### Q3GroupBox::Q3GroupBox ( QWidget * parent = 0, const char * name = 0 )

Constructs a group box widget with no title.

The parent and name arguments are passed to the QWidget constructor.

This constructor does not do automatic layout.

### Q3GroupBox::Q3GroupBox ( const QString & title, QWidget * parent = 0, const char * name = 0 )

Constructs a group box with the title title.

The parent and name arguments are passed to the QWidget constructor.

This constructor does not do automatic layout.

### Q3GroupBox::Q3GroupBox ( int strips, Qt::Orientation orientation, QWidget * parent = 0, const char * name = 0 )

Constructs a group box with no title. Child widgets will be arranged in strips rows or columns (depending on orientation).

The parent and name arguments are passed to the QWidget constructor.

### Q3GroupBox::Q3GroupBox ( int strips, Qt::Orientation orientation, const QString & title, QWidget * parent = 0, const char * name = 0 )

Constructs a group box titled title. Child widgets will be arranged in strips rows or columns (depending on orientation).

The parent and name arguments are passed to the QWidget constructor.

### Q3GroupBox::~Q3GroupBox ()

Destroys the group box.

### void Q3GroupBox::addSpace ( int size )

Adds an empty cell at the next free position. If size is greater than 0, the empty cell takes size to be its fixed width (if orientation() is `Horizontal`) or height (if orientation() is `Vertical`).

Use this method to separate the widgets in the group box or to skip the next free cell. For performance reasons, call this method after calling setColumnLayout() or by changing the Q3GroupBox::columns or Q3GroupBox::orientation properties. It is generally a good idea to call these methods first (if needed at all), and insert the widgets and spaces afterwards.

### int Q3GroupBox::insideMargin () const

Returns the width of the empty space between the items in the group and the frame of the group.

Only applies if the group box has a defined orientation.

The default is usually 11, by may vary depending on the platform and style.

See also setInsideMargin() and orientation.

### int Q3GroupBox::insideSpacing () const

Returns the width of the empty space between each of the items in the group.

Only applies if the group box has a defined orientation.

The default is usually 5, by may vary depending on the platform and style.

See also setInsideSpacing() and orientation.

### void Q3GroupBox::setColumnLayout ( int strips, Qt::Orientation direction ) `[virtual]`

Changes the layout of the group box. This function is only useful in combination with the default constructor that does not take any layout information. This function will put all existing children in the new layout. It is not good Qt programming style to call this function after children have been inserted. Sets the number of columns or rows to be strips, depending on direction.

See also orientation and columns.

### void Q3GroupBox::setInsideMargin ( int m )

Sets the the width of the inside margin to m pixels.

See also insideMargin().

### void Q3GroupBox::setInsideSpacing ( int s )

Sets the width of the empty space between each of the items in the group to s pixels.

See also insideSpacing().

### void Q3GroupBox::toggled ( bool on ) `[signal]`

If the group box has a check box (see isCheckable()) this signal is emitted when the check box is toggled. on is true if the check box is checked; otherwise it is false.