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

# QGroupBox Class Reference

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

    #include <QGroupBox>

Inherits QWidget.

- List of all members, including inherited members
- Compatibility members

### Writable Properties

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

- flat : bool
- title : QString

- 33 writable properties inherited from QWidget
- 1 writable property inherited from QObject

### Read-Only Properties

- 20 read-only properties inherited from QWidget

### Public Functions

- QGroupBox ( QWidget * parent = 0 )
- QGroupBox ( const QString & title, QWidget * parent = 0 )
- ~QGroupBox ()

- 92 public functions inherited from QWidget
- 26 public functions inherited from QObject
- 10 public functions inherited from QPaintDevice

### Public Slots

- void setChecked ( bool b )

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

### Signals

- void toggled ( bool on )

- 1 signal inherited from QObject

### Static Public Members

- 4 static public members inherited from QWidget
- 4 static public members inherited from QObject

### Protected Functions

- 42 protected functions inherited from QWidget
- 7 protected functions inherited from QObject

## Detailed Description

The QGroupBox 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.

QGroupBox also lets you set the title (normally set in the constructor) and the title's alignment(). If setCheckable(true) is called then the group box is checkable(), and it can be setChecked(). Checkable group boxes child widgets are enabled or disabled depending on whether or not the group box is checked().

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:

- Qt::Alignment alignment () const
- 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 group box has a check box (see isCheckable()), and the check box is checked (see isChecked()), the group box's children are enabled. If the checkbox is unchecked the children are disabled.

Access functions:

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

### 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.

### title : QString

This property holds the group box title text.

The group box title text will have a focus-change keyboard shortcut 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
- void setTitle ( const QString & )

## Member Function Documentation

### QGroupBox::QGroupBox ( QWidget * parent = 0 )

Constructs a group box widget with no title and parent parent.

### QGroupBox::QGroupBox ( const QString & title, QWidget * parent = 0 )

Constructs a group box with the title title and parent parent.

### QGroupBox::~QGroupBox ()

Destroys the group box.

### void QGroupBox::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.