Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.gui
Class QButtonGroup

    java.lang.Object
      com.trolltech.qt.internal.QSignalEmitterInternal
          com.trolltech.qt.QSignalEmitter
              com.trolltech.qt.QtJambiObject
                  com.trolltech.qt.core.QObject
                      com.trolltech.qt.gui.QButtonGroup

All Implemented Interfaces:
  QtJambiInterface

    public class QButtonGroup

extends QObject

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, `QCheckBox`es (normally for non-exclusive button groups), or `QRadioButton`s. If you create an exclusive button group, you should ensure that one of the buttons in the group is initially checked; otherwise, the group will initially be in a state where no buttons are checked.

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 clicked the `buttonClicked()` signal is emitted. For a checkable button in an exclusive group this means that the button was checked. The list of buttons in the group is returned by `buttons()`.

In addition, `QButtonGroup` can map between integers and buttons. You can assign an integer id to a button with `setId()`, and retrieve it with `id()`. The id of the currently checked button is available with `checkedId()`, and there is an overloaded signal `buttonClicked()` which emits the id of the button. The purpose of the mapping mechanism is to simplify the representation of enum values in a user interface.

See also:
  `QGroupBox`, `QPushButton`, `QCheckBox`, and `QRadioButton`.

Nested Class Summary

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9`

Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal`

Field Summary
`QSignalEmitter.Signal1` | `buttonClicked` This signal takes 1 generic argument(s).
`QSignalEmitter.Signal1` | `buttonIdClicked` This signal takes 1 generic argument(s).
`QSignalEmitter.Signal1` | `buttonIdPressed` This signal takes 1 generic argument(s).
`QSignalEmitter.Signal1` | `buttonIdReleased` This signal takes 1 generic argument(s).
`QSignalEmitter.Signal1` | `buttonPressed` This signal takes 1 generic argument(s).
`QSignalEmitter.Signal1` | `buttonReleased` This signal takes 1 generic argument(s).

Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`currentSender`

Constructor Summary
`QButtonGroup()` Constructs a new, empty button group with the given `parent`.
`QButtonGroup(QObject parent)` Constructs a new, empty button group with the given `parent`.

Method Summary
`void` | `addButton(QAbstractButton arg__1)` Adds the given `button` to the end of the group's internal list of buttons.
`void` | `addButton(QAbstractButton arg__1, int id)` Adds the given `button` to the button group, with the given `id`.
`QAbstractButton` | `button(int id)` Returns the button with the specified `id`, or 0 if no such button exists.
`java.util.List` | `buttons()` Returns the list of this groups's buttons.
`QAbstractButton` | `checkedButton()` Returns the button group's checked button, or 0 if no buttons are checked.
`int` | `checkedId()` Returns the id of the `checkedButton()`, or -1 if no button is checked.
`boolean` | `exclusive()` This property holds whether the button group is exclusive.
`int` | `id(QAbstractButton button)` Returns the id for the specified `button`, or -1 if no such button exists.
`void` | `removeButton(QAbstractButton arg__1)` Removes the given `button` from the button group.
`void` | `setExclusive(boolean arg__1)` This property holds whether the button group is exclusive.
`void` | `setId(QAbstractButton button, int id)` Sets the `id` for the specified `button`.

Methods inherited from class com.trolltech.qt.core.QObject
`childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty`

Methods inherited from class com.trolltech.qt.QtJambiObject
`dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr`

Methods inherited from class com.trolltech.qt.QSignalEmitter
`blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread`

Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`__qt_signalInitialization`

Methods inherited from class java.lang.Object
`clone, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface com.trolltech.qt.QtJambiInterface
`disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership`

Field Detail

### buttonClicked

    public final QSignalEmitter.Signal1 buttonClicked

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <com.trolltech.qt.gui.QAbstractButton(named: button)>:

  This signal is emitted when the given `button` is clicked. A button is clicked when it is first pressed and then released, when its shortcut key is typed, or programmatically when `QAbstractButton::click()` or `QAbstractButton::animateClick()` is called.

See also:
  `checkedButton()`, and `QAbstractButton::clicked()` .

### buttonIdClicked

    public final QSignalEmitter.Signal1 buttonIdClicked

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.Integer(named: arg__1)>:

### buttonPressed

    public final QSignalEmitter.Signal1 buttonPressed

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <com.trolltech.qt.gui.QAbstractButton(named: button)>:

  This signal is emitted when the given `button` is pressed down.

See also:
  `QAbstractButton::pressed()` .

### buttonIdPressed

    public final QSignalEmitter.Signal1 buttonIdPressed

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.Integer(named: arg__1)>:

### buttonReleased

    public final QSignalEmitter.Signal1 buttonReleased

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <com.trolltech.qt.gui.QAbstractButton(named: button)>:

  This signal is emitted when the given `button` is released.

See also:
  `QAbstractButton::released()` .

### buttonIdReleased

    public final QSignalEmitter.Signal1 buttonIdReleased

  This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <java.lang.Integer(named: arg__1)>:

Constructor Detail

### QButtonGroup

    public QButtonGroup()

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

See also:
  `addButton()`, and `setExclusive()`.

### QButtonGroup

    public QButtonGroup(QObject parent)

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

See also:
  `addButton()`, and `setExclusive()`.

Method Detail

### addButton

    public final void addButton(QAbstractButton arg__1)

  Adds the given `button` to the end of the group's internal list of buttons.

See also:
  `removeButton()`.

### addButton

    public final void addButton(QAbstractButton arg__1,
                                int id)

  Adds the given `button` to the button group, with the given `id`.

See also:
  `removeButton()`, and `buttons()`.

### button

    public final QAbstractButton button(int id)

  Returns the button with the specified `id`, or 0 if no such button exists.

### buttons

    public final java.util.List buttons()

  Returns the list of this groups's buttons. This may be empty.

See also:
  `addButton()`, and `removeButton()`.

### checkedButton

    public final QAbstractButton checkedButton()

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

See also:
  `buttonClicked()` .

### checkedId

    public final int checkedId()

  Returns the id of the `checkedButton()`, or -1 if no button is checked.

See also:
  `setId()`.

### exclusive

    public final boolean exclusive()

  This property holds whether the button group is exclusive. If this property is true then only one button in the group can be checked at any given time. The user can click on any button to check it, and that button will replace the existing one as the checked button in the group.

  In an exclusive group, the user cannot uncheck the currently checked button by clicking on it; instead, another button in the group must be clicked to set the new checked button for that group.

  By default, this property is true.

### id

    public final int id(QAbstractButton button)

  Returns the id for the specified `button`, or -1 if no such button exists.

See also:
  `setId()`.

### removeButton

    public final void removeButton(QAbstractButton arg__1)

  Removes the given `button` from the button group.

See also:
  `addButton()`, and `buttons()`.

### setExclusive

    public final void setExclusive(boolean arg__1)

  This property holds whether the button group is exclusive. If this property is true then only one button in the group can be checked at any given time. The user can click on any button to check it, and that button will replace the existing one as the checked button in the group.

  In an exclusive group, the user cannot uncheck the currently checked button by clicking on it; instead, another button in the group must be clicked to set the new checked button for that group.

  By default, this property is true.

### setId

    public final void setId(QAbstractButton button,
                            int id)

  Sets the `id` for the specified `button`.

See also:
  `id()`.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD