Eneboo - Documentación para desarrolladores
Señales | Métodos públicos | Métodos protegidos | Propiedades
Referencia de la Clase QActionGroup

The QActionGroup class groups actions together. Más...

#include <qaction.h>

Diagrama de herencias de QActionGroup
QAction QAction QObject QObject QObject QObject Qt Qt Qt Qt Qt Qt Qt Qt QDesignerActionGroup

Lista de todos los miembros.

Señales

void selected (QAction *)
void selected (QAction *)

Métodos públicos

 QActionGroup (QObject *parent, const char *name=0)
 QActionGroup (QObject *parent, const char *name, bool exclusive)
 ~QActionGroup ()
void setExclusive (bool)
bool isExclusive () const
void add (QAction *a)
void addSeparator ()
bool addTo (QWidget *)
bool removeFrom (QWidget *)
void setEnabled (bool)
void setToggleAction (bool toggle)
void setOn (bool on)
void setUsesDropDown (bool enable)
bool usesDropDown () const
void setIconSet (const QIconSet &)
void setText (const QString &)
void setMenuText (const QString &)
void setToolTip (const QString &)
void setWhatsThis (const QString &)
void insert (QAction *a)
 QActionGroup (QObject *parent, const char *name=0)
 QActionGroup (QObject *parent, const char *name, bool exclusive)
 ~QActionGroup ()
void setExclusive (bool)
bool isExclusive () const
void add (QAction *a)
void addSeparator ()
bool addTo (QWidget *)
bool removeFrom (QWidget *)
void setEnabled (bool)
void setToggleAction (bool toggle)
void setOn (bool on)
void setUsesDropDown (bool enable)
bool usesDropDown () const
void setIconSet (const QIconSet &)
void setText (const QString &)
void setMenuText (const QString &)
void setToolTip (const QString &)
void setWhatsThis (const QString &)
void insert (QAction *a)

Métodos protegidos

void childEvent (QChildEvent *)
virtual void addedTo (QWidget *actionWidget, QWidget *container, QAction *a)
virtual void addedTo (int index, QPopupMenu *menu, QAction *a)
virtual void addedTo (QWidget *actionWidget, QWidget *container)
virtual void addedTo (int index, QPopupMenu *menu)
void childEvent (QChildEvent *)
virtual void addedTo (QWidget *actionWidget, QWidget *container, QAction *a)
virtual void addedTo (int index, QPopupMenu *menu, QAction *a)
virtual void addedTo (QWidget *actionWidget, QWidget *container)
virtual void addedTo (int index, QPopupMenu *menu)

Propiedades

bool exclusive
 whether the action group does exclusive toggling
bool usesDropDown
 whether the group's actions are displayed in a subwidget of the widgets the action group is added to

Descripción detallada

The QActionGroup class groups actions together.

In some situations it is useful to group actions together. For example, if you have a left justify action, a right justify action and a center action, only one of these actions should be active at any one time, and one simple way of achieving this is to group the actions together in an action group.

An action group can also be added to a menu or a toolbar as a single unit, with all the actions within the action group appearing as separate menu options and toolbar buttons.

Here's an example from examples/textedit: textedit/textedit.cpp QActionGroup connect

Here we create a new action group. Since the action group is exclusive by default, only one of the actions in the group is ever active at any one time. We then connect the group's selected() signal to our textAlign() slot.

actionAlignLeft->setToggleAction

We create a left align action, add it to the toolbar and the menu and make it a toggle action. We create center and right align actions in exactly the same way.

A QActionGroup emits an activated() signal when one of its actions is activated. The actions in an action group emit their activated() (and for toggle actions, toggled()) signals as usual.

The setExclusive() function is used to ensure that only one action is active at any one time: it should be used with actions which have their toggleAction set to TRUE.

Action group actions appear as individual menu options and toolbar buttons. For exclusive action groups use setUsesDropDown() to display the actions in a subwidget of any widget the action group is added to. For example, the actions would appear in a combobox in a toolbar or as a submenu in a menu.

Actions can be added to an action group using add(), but normally they are added by creating the action with the action group as parent. Actions can have separators dividing them using addSeparator(). Action groups are added to widgets with addTo().


Documentación del constructor y destructor

QActionGroup::QActionGroup ( QObject parent,
const char *  name = 0 
)

Constructs an action group called name, with parent parent.

The action group is exclusive by default. Call setExclusive(FALSE) to make the action group non-exclusive.

QActionGroup::QActionGroup ( QObject parent,
const char *  name,
bool  exclusive 
)

Constructs an action group called name, with parent parent.

If exclusive is TRUE only one toggle action in the group will ever be active.

Ver también:
exclusive
QActionGroup::~QActionGroup ( )

Destroys the object and frees allocated resources.

QActionGroup::QActionGroup ( QObject parent,
const char *  name = 0 
)
QActionGroup::QActionGroup ( QObject parent,
const char *  name,
bool  exclusive 
)
QActionGroup::~QActionGroup ( )

Documentación de las funciones miembro

void QActionGroup::add ( QAction action)

Adds action action to this group.

Normally an action is added to a group by creating it with the group as parent, so this function is not usually used.

Ver también:
addTo()
void QActionGroup::add ( QAction a)
void QActionGroup::addedTo ( QWidget actionWidget,
QWidget container,
QAction a 
) [protected, virtual]

Reimplementado en QDesignerActionGroup.

void QActionGroup::addedTo ( int  index,
QPopupMenu menu,
QAction a 
) [protected, virtual]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.

virtual void QActionGroup::addedTo ( QWidget actionWidget,
QWidget container 
) [protected, virtual]

This function is called from the addTo() function when it has created a widget (actionWidget) for the action in the container.

Reimplementado de QAction.

Reimplementado en QDesignerActionGroup.

void QActionGroup::addedTo ( QWidget actionWidget,
QWidget container 
) [protected, virtual]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. This function is called from the addTo() function when it has created a widget (actionWidget) in the container.

Reimplementado de QAction.

Reimplementado en QDesignerActionGroup.

void QActionGroup::addedTo ( int  index,
QPopupMenu menu 
) [protected, virtual]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. This function is called from the addTo() function when it has created a menu item at the index position index in the popup menu menu.

Reimplementado de QAction.

Reimplementado en QDesignerActionGroup.

virtual void QActionGroup::addedTo ( QWidget actionWidget,
QWidget container,
QAction a 
) [protected, virtual]

Reimplementado en QDesignerActionGroup.

virtual void QActionGroup::addedTo ( int  index,
QPopupMenu menu,
QAction a 
) [protected, virtual]
virtual void QActionGroup::addedTo ( int  index,
QPopupMenu menu 
) [protected, virtual]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. This function is called from the addTo() function when it has created a menu item at the index position index in the popup menu menu.

Reimplementado de QAction.

Reimplementado en QDesignerActionGroup.

void QActionGroup::addSeparator ( )

Adds a separator to the group.

void QActionGroup::addSeparator ( )
bool QActionGroup::addTo ( QWidget w) [virtual]

Adds this action group to the widget w.

If isExclusive() is FALSE or usesDropDown() is FALSE, the actions within the group are added to the widget individually. For example, if the widget is a menu, the actions will appear as individual menu options, and if the widget is a toolbar, the actions will appear as toolbar buttons.

If both isExclusive() and usesDropDown() are TRUE, the actions are presented either in a combobox (if w is a toolbar) or in a submenu (if w is a menu).

All actions should be added to the action group before the action group is added to the widget. If actions are added to the action group after the action group has been added to the widget these later actions will not appear.

Ver también:
setExclusive() setUsesDropDown() removeFrom()

Reimplementado de QAction.

bool QActionGroup::addTo ( QWidget w) [virtual]

Adds this action to widget w.

Currently actions may be added to QToolBar and QPopupMenu widgets.

An action added to a tool bar is automatically displayed as a tool button; an action added to a pop up menu appears as a menu option.

addTo() returns TRUE if the action was added successfully and FALSE otherwise. (If w is not a QToolBar or QPopupMenu the action will not be added and FALSE will be returned.)

Ver también:
removeFrom()

Reimplementado de QAction.

void QActionGroup::childEvent ( QChildEvent e) [protected, virtual]

Reimplementado de QObject.

void QActionGroup::childEvent ( QChildEvent ) [protected, virtual]

This event handler can be reimplemented in a subclass to receive child events.

Child events are sent to objects when children are inserted or removed.

Note that events with QEvent::type() QEvent::ChildInserted are posted (with {QApplication::postEvent()}) to make sure that the child's construction is completed before this function is called.

If a child is removed immediately after it is inserted, the ChildInserted event may be suppressed, but the ChildRemoved event will always be sent. In such cases it is possible that there will be a ChildRemoved event without a corresponding ChildInserted event.

If you change state based on ChildInserted events, call QWidget::constPolish(), or do

in functions that depend on the state. One notable example is QWidget::sizeHint().

Ver también:
event(), QChildEvent

Reimplementado de QObject.

void QActionGroup::insert ( QAction a) [inline]

Use add() instead, or better still create the action with the action group as its parent.

void QActionGroup::insert ( QAction a) [inline]
bool QActionGroup::isExclusive ( ) const
bool QActionGroup::isExclusive ( ) const
bool QActionGroup::removeFrom ( QWidget w) [virtual]

Reimplementado de QAction.

bool QActionGroup::removeFrom ( QWidget w) [virtual]

Removes the action from widget w.

Returns TRUE if the action was removed successfully; otherwise returns FALSE.

Ver también:
addTo()

Reimplementado de QAction.

void QActionGroup::selected ( QAction ) [signal]
void QActionGroup::selected ( QAction t0) [signal]

This signal is emitted from exclusive groups when toggle actions change state.

The argument is the action whose state changed to "on".

Ver también:
setExclusive(), isOn() QAction::toggled()
void QActionGroup::setEnabled ( bool  enable) [virtual]

Reimplementado de QAction.

void QActionGroup::setEnabled ( bool  ) [virtual]

Reimplementado de QAction.

void QActionGroup::setExclusive ( bool  enable)
void QActionGroup::setExclusive ( bool  )
void QActionGroup::setIconSet ( const QIconSet ) [virtual]

Reimplementado de QAction.

void QActionGroup::setIconSet ( const QIconSet icon) [virtual]

Reimplementado de QAction.

void QActionGroup::setMenuText ( const QString ) [virtual]

Reimplementado de QAction.

void QActionGroup::setMenuText ( const QString text) [virtual]

Reimplementado de QAction.

void QActionGroup::setOn ( bool  on) [virtual]

Reimplementado de QAction.

void QActionGroup::setOn ( bool  on) [virtual]

Reimplementado de QAction.

void QActionGroup::setText ( const QString ) [virtual]

Reimplementado de QAction.

void QActionGroup::setText ( const QString txt) [virtual]

Reimplementado de QAction.

void QActionGroup::setToggleAction ( bool  toggle) [virtual]

Reimplementado de QAction.

void QActionGroup::setToggleAction ( bool  toggle) [virtual]

Reimplementado de QAction.

void QActionGroup::setToolTip ( const QString text) [virtual]

Reimplementado de QAction.

void QActionGroup::setToolTip ( const QString ) [virtual]

Reimplementado de QAction.

void QActionGroup::setUsesDropDown ( bool  enable)
void QActionGroup::setUsesDropDown ( bool  enable)
void QActionGroup::setWhatsThis ( const QString ) [virtual]

Reimplementado de QAction.

void QActionGroup::setWhatsThis ( const QString text) [virtual]

Reimplementado de QAction.

bool QActionGroup::usesDropDown ( ) const
bool QActionGroup::usesDropDown ( ) const

Documentación de propiedades

bool QActionGroup::exclusive [read, write]

whether the action group does exclusive toggling

If exclusive is TRUE only one toggle action in the action group can ever be active at any one time. If the user chooses another toggle action in the group the one they chose becomes active and the one that was active becomes inactive.

Ver también:
QAction::toggleAction
bool QActionGroup::usesDropDown [read, write]

whether the group's actions are displayed in a subwidget of the widgets the action group is added to

Exclusive action groups added to a toolbar display their actions in a combobox with the action's QAction::text and QAction::iconSet properties shown. Non-exclusive groups are represented by a tool button showing their QAction::iconSet and -- depending on QMainWindow::usesTextLabel() -- text() property.

In a popup menu the member actions are displayed in a submenu.

Changing usesDropDown only affects subsequent calls to addTo().

Note that setting this property for actions in a combobox causes calls to their QAction::setVisible(), QAction::setEnabled(), and QAction::setDisabled() functions to have no effect.

This property's default is FALSE.


La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'