Qt Jambi Home

com.trolltech.qt.gui
Class QButtonGroup

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.core.QObject
              extended by 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, QCheckBoxes (normally for non-exclusive button groups), or QRadioButtons. 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, QRadioButton

Nested Class Summary
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
Field Summary
 QSignalEmitter.Signal1<QAbstractButton> buttonClicked
          This signal is emitted when the given arg__1 is clicked.
 QSignalEmitter.Signal1<java.lang.Integer> buttonIdClicked
          This signal is emitted when a button with the given arg__1 is clicked.
 QSignalEmitter.Signal1<java.lang.Integer> buttonIdPressed
          This signal is emitted when a button with the given arg__1 is pressed down.
 QSignalEmitter.Signal1<java.lang.Integer> buttonIdReleased
          This signal is emitted when a button with the given arg__1 is released.
 QSignalEmitter.Signal1<QAbstractButton> buttonPressed
          This signal is emitted when the given arg__1 is pressed down.
 QSignalEmitter.Signal1<QAbstractButton> buttonReleased
          This signal is emitted when the given arg__1 is released.
 
Constructor Summary
QButtonGroup()
          Equivalent to QButtonGroup(0).
QButtonGroup(QObject parent)
          Constructs a new, empty button group with the given parent.
 
Method Summary
 void addButton(QAbstractButton arg__1)
          Adds the given arg__1 to the end of the group's internal list of buttons.
 void addButton(QAbstractButton arg__1, int id)
          Adds the given arg__1 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<QAbstractButton> 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()
          Returns whether the button group is exclusive.
static QButtonGroup fromNativePointer(QNativePointer nativePointer)
          This function returns the QButtonGroup instance pointed to by nativePointer
 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 arg__1 from the button group.
 void setExclusive(boolean arg__1)
          Sets whether the button group is exclusive to arg__1.
 void setId(QAbstractButton button, int id)
          Sets the id for the specified button.
 
Methods inherited from class com.trolltech.qt.core.QObject
blockSignals, childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread, timerEvent
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
disconnect, disconnect, signalSender
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Field Detail

buttonIdClicked

public final QSignalEmitter.Signal1<java.lang.Integer> buttonIdClicked

This signal is emitted when a button with the given arg__1 is clicked.

Compatible Slot Signatures:
void mySlot(int arg__1)
void mySlot()
See Also:
checkedButton, QAbstractButton::clicked


buttonClicked

public final QSignalEmitter.Signal1<QAbstractButton> buttonClicked

This signal is emitted when the given arg__1 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.

Compatible Slot Signatures:
void mySlot(com.trolltech.qt.gui.QAbstractButton arg__1)
void mySlot()
See Also:
checkedButton, QAbstractButton::clicked


buttonPressed

public final QSignalEmitter.Signal1<QAbstractButton> buttonPressed

This signal is emitted when the given arg__1 is pressed down.

Compatible Slot Signatures:
void mySlot(com.trolltech.qt.gui.QAbstractButton arg__1)
void mySlot()
See Also:
QAbstractButton::pressed


buttonIdPressed

public final QSignalEmitter.Signal1<java.lang.Integer> buttonIdPressed

This signal is emitted when a button with the given arg__1 is pressed down.

Compatible Slot Signatures:
void mySlot(int arg__1)
void mySlot()
See Also:
QAbstractButton::pressed


buttonReleased

public final QSignalEmitter.Signal1<QAbstractButton> buttonReleased

This signal is emitted when the given arg__1 is released.

Compatible Slot Signatures:
void mySlot(com.trolltech.qt.gui.QAbstractButton arg__1)
void mySlot()
See Also:
QAbstractButton::released


buttonIdReleased

public final QSignalEmitter.Signal1<java.lang.Integer> buttonIdReleased

This signal is emitted when a button with the given arg__1 is released.

Compatible Slot Signatures:
void mySlot(int arg__1)
void mySlot()
See Also:
QAbstractButton::released

Constructor Detail

QButtonGroup

public QButtonGroup()

Equivalent to QButtonGroup(0).


QButtonGroup

public QButtonGroup(QObject parent)

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

See Also:
addButton, setExclusive
Method Detail

addButton

public final void addButton(QAbstractButton arg__1,
                            int id)

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

See Also:
removeButton, buttons

addButton

public final void addButton(QAbstractButton arg__1)

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

See Also:
removeButton

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<QAbstractButton> buttons()

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

See Also:
addButton, 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()

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

See Also:
setExclusive

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 arg__1 from the button group.

See Also:
addButton, buttons

setExclusive

public final void setExclusive(boolean arg__1)

Sets whether the button group is exclusive to arg__1.

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.

See Also:
exclusive

setId

public final void setId(QAbstractButton button,
                        int id)

Sets the id for the specified button.

See Also:
id

fromNativePointer

public static QButtonGroup fromNativePointer(QNativePointer nativePointer)
This function returns the QButtonGroup instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.

Qt Jambi Home