|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.core.QObject
com.trolltech.qt.gui.QActionGroup
public class QActionGroup
The QActionGroup
class groups actions together. In some situations it is useful to group actions together. For example, if you have a Left Align action, a Right Align action, a Justify action, and a Center action, only one of these actions should be active at any one time. One simple way of achieving this is to group the actions together in an action group.
Here's a example (from the Menus example):
The following code example is written in c++.
alignmentGroup = new QActionGroup(this); alignmentGroup->addAction(leftAlignAct); alignmentGroup->addAction(rightAlignAct); alignmentGroup->addAction(justifyAct); alignmentGroup->addAction(centerAct); leftAlignAct->setChecked(true);Here we create a new action group. Since the action group is exclusive by default, only one of the actions in the group is checked at any one time.
QActionGroup
emits an triggered()
signal when one of its actions is chosen. Each action in an action group emits its triggered()
signal as usual. As stated above, an action group is exclusive
by default; it ensures that only one checkable action is active at any one time. If you want to group checkable actions without making them exclusive, you can turn of exclusiveness by calling setExclusive(false).
Actions can be added to an action group using addAction()
, but it is usually more convenient to specify a group when creating actions; this ensures that actions are automatically created with a parent. Actions can be visually separated from each other by adding a separator action to the group; create an action and use QAction
's setSeparator()
function to make it considered a separator. Action groups are added to widgets with the QWidget::addActions()
function.
QAction
.
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 |
hovered
This signal takes 1 generic argument(s). |
QSignalEmitter.Signal1 |
triggered
This signal takes 1 generic argument(s). |
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
currentSender |
Constructor Summary | |
---|---|
QActionGroup(QObject parent)
Constructs an action group for the parent object. |
Method Summary | |
---|---|
java.util.List |
actions()
Returns the list of this groups's actions. |
QAction |
addAction(QAction a)
Adds the action to this group, and returns it. |
QAction |
addAction(QIcon icon,
java.lang.String text)
Creates and returns an action with text and an icon. |
QAction |
addAction(java.lang.String text)
Creates and returns an action with text. |
QAction |
checkedAction()
Returns the currently checked action in the group, or 0 if none are checked. |
boolean |
isEnabled()
This property holds whether the action group is enabled. |
boolean |
isExclusive()
This property holds whether the action group does exclusive checking. |
boolean |
isVisible()
This property holds whether the action group is visible. |
void |
removeAction(QAction a)
Removes the action from this group. |
void |
setDisabled(boolean b)
This is a convenience function for the enabled property, that is useful for signals--slots connections. |
void |
setEnabled(boolean arg__1)
This property holds whether the action group is enabled. |
void |
setExclusive(boolean arg__1)
This property holds whether the action group does exclusive checking. |
void |
setVisible(boolean arg__1)
This property holds whether the action group is visible. |
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 |
---|
public final QSignalEmitter.Signal1 hovered
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.QAction(named: action)>:
This signal is emitted when the given action in the action group is highlighted by the user; for example, when the user pauses with the cursor over a menu option, toolbar button, or presses an action's shortcut key combination.
QAction::activate()
.
public final QSignalEmitter.Signal1 triggered
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.QAction(named: action)>:
This signal is emitted when the given action in the action group is activated by the user; for example, when the user clicks a menu option, toolbar button, or presses an action's shortcut key combination.
Connect to this signal for command actions.
QAction::activate()
.
Constructor Detail |
---|
public QActionGroup(QObject parent)
The action group is exclusive by default. Call setExclusive(false) to make the action group non-exclusive.
Method Detail |
---|
public final java.util.List actions()
public final QAction addAction(QAction a)
Normally an action is added to a group by creating it with the group as its parent, so this function is not usually used.
QAction::setActionGroup()
.
public final QAction addAction(QIcon icon, java.lang.String text)
Normally an action is added to a group by creating it with the group as its parent, so this function is not usually used.
QAction::setActionGroup()
.
public final QAction addAction(java.lang.String text)
Normally an action is added to a group by creating it with the group as parent, so this function is not usually used.
QAction::setActionGroup()
.
public final QAction checkedAction()
public final boolean isEnabled()
QAction::setEnabled()
.
public final boolean isExclusive()
QAction::checkable
.
public final boolean isVisible()
QAction::setEnabled()
.
public final void removeAction(QAction a)
QAction::setActionGroup()
.
public final void setDisabled(boolean b)
enabled
property, that is useful for signals--slots connections. If b is true the action group is disabled; otherwise it is enabled.
public final void setEnabled(boolean arg__1)
QAction::setEnabled()
.
public final void setExclusive(boolean arg__1)
QAction::checkable
.
public final void setVisible(boolean arg__1)
QAction::setEnabled()
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |