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

# QButtonGroup Class Reference

The QButtonGroup class provides a container to organize groups of button widgets. More...

    #include <QButtonGroup>

Inherits QObject.

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

### Writable Properties

- exclusive : bool

- 1 writable property inherited from QObject

### Public Functions

- QButtonGroup ( QObject * parent = 0 )
- ~QButtonGroup ()
- void addButton ( QAbstractButton * button )
- QAbstractButton * checkedButton () const
- int count () const
- void removeButton ( QAbstractButton * button )

- 26 public functions inherited from QObject

### Public Slots

- 1 public slot inherited from QObject

### Signals

- void buttonChecked ( QAbstractButton * button )

- 1 signal inherited from QObject

### Static Public Members

- 4 static public members inherited from QObject

### Protected Functions

- 7 protected functions inherited from QObject

## Detailed Description

The QButtonGroup class provides a container to organize groups of button widgets.

QButtonGroup provides an abstract container into which button widgets can be placed. It does not provide a visual representation of this container (see QGroupBox for a container widget), but instead manages the states of each of the buttons in the group.

An exclusive button group switches off all checkable (toggle) buttons except the one that was clicked. By default, a button group is exclusive. The buttons in a button group are usually checkable QPushButton's, QCheckBoxes (normally for non-exclusive button groups), or QRadioButtons.

A button is added to the group with addButton(). It can be removed from the group with removeButton(). If the group is exclusive, the currently checked button is available as checkedButton(). If a button is checked the buttonChecked() signal is emitted. The number of buttons in the group is returned by count().

See also QGroupBox, QPushButton, QCheckBox, and QRadioButton.

## Property Documentation

### exclusive : bool

This property holds whether the button group is exclusive.

If this property is true, then the buttons in the group are checked (toggled), and to untoggle a button you must click on another button in the group. The default value is true.

Access functions:

- bool exclusive () const
- void setExclusive ( bool )

## Member Function Documentation

### QButtonGroup::QButtonGroup ( QObject * parent = 0 )

Constructs a new, empty button group with the given parent.

See also addButton() and setExclusive().

### QButtonGroup::~QButtonGroup ()

Destroys the button group and all its child widgets.

### void QButtonGroup::addButton ( QAbstractButton * button )

Adds the given button to the button group.

See also removeButton() and count().

### void QButtonGroup::buttonChecked ( QAbstractButton * button ) `[signal]`

This signal is emitted when the given button is checked.

See also checkedButton().

### QAbstractButton * QButtonGroup::checkedButton () const

Returns the button group's checked button, or 0 if no buttons are checked.

See also buttonChecked().

### int QButtonGroup::count () const

Returns the number of buttons in the group.

### void QButtonGroup::removeButton ( QAbstractButton * button )

Removes the given button from the button group.

See also addButton() and count().