An action class which is represented in the menu bar (or toolbar) as a group of items (which can be customized). More...
#include <QtxActionSet.h>
Signals | |
void | triggered (int) |
Emitted when some child action is activated by the user. More... | |
void | triggered (QAction *) |
Emitted when some child action is activated by the user. More... | |
Public Member Functions | |
QtxActionSet (QObject *=0) | |
Constructor. More... | |
virtual | ~QtxActionSet () |
Destructor. More... | |
QList< QAction * > | actions () const |
Get list of child actions. More... | |
void | setActions (const QList< QAction * > &) |
Assign child actions. More... | |
void | insertActions (const QList< QAction * > &, const int=-1) |
Insert actions at the specified position. More... | |
int | insertAction (QAction *, const int id=-1, const int=-1) |
Insert action at the specified position. More... | |
int | insertAction (const QString &, const int id=-1, const int=-1) |
Insert action at the specified position. More... | |
int | insertAction (const QString &, const QIcon &, const int id=-1, const int=-1) |
Insert action at the specified position. More... | |
void | removeAction (QAction *) |
Remove specified action. More... | |
void | removeAction (const int) |
Remove specified action. More... | |
void | clear () |
Remove all actions. More... | |
Public Member Functions inherited from QtxAction | |
QtxAction (QObject *=0, bool=false, const QString &=QString()) | |
Constructor. More... | |
QtxAction (const QString &, const QString &, int, QObject *, bool=false, const QString &=QString()) | |
Constructor. More... | |
QtxAction (const QString &, const QString &, const QKeySequence &, QObject *, bool=false, const QString &=QString()) | |
Constructor. More... | |
QtxAction (const QString &, const QIcon &, const QString &, int, QObject *, bool=false, const QString &=QString()) | |
Constructor. More... | |
QtxAction (const QString &, const QIcon &, const QString &, const QKeySequence &, QObject *, bool=false, const QString &=QString()) | |
Constructor. More... | |
virtual | ~QtxAction () |
Destructor. More... | |
virtual bool | eventFilter (QObject *, QEvent *) |
Customize action events. More... | |
QString | shortcutActionName () const |
Return shortcut action name for the action. More... | |
void | setShortcutActionName (const QString &) |
Set shortcut action name to the action. More... | |
Protected Member Functions | |
virtual void | addedTo (QWidget *) |
Called when this action set is added to the menu bar (or toolbar). More... | |
virtual void | removedFrom (QWidget *) |
Called when this action set is removed from the menu bar (or toolbar). More... | |
virtual void | actionAdded (QAction *) |
Notify that action was added. More... | |
virtual void | actionRemoved (QAction *) |
Notify that action was removed. More... | |
QAction * | action (int) const |
Get action by specified identifier. More... | |
int | actionId (QAction *) const |
Get action identifier for the action. More... | |
void | setActionId (QAction *, const int) |
Set action identifier for the action. More... | |
virtual bool | isEmptyAction () const |
Check if the action itself should be invisible (only child action are shown) More... | |
virtual void | updateAction () |
Update action set. More... | |
virtual void | updateAction (QWidget *) |
Update action set for the specified widget. More... | |
Protected Member Functions inherited from QtxAction | |
virtual void | customEvent (QEvent *) |
Process notification events. More... | |
Private Types | |
typedef QList< QAction * > | ActionList |
Private Slots | |
void | onChanged () |
Called when action is changed. More... | |
void | onActionTriggered (bool=false) |
Called when some action is activated by the user. More... | |
Private Member Functions | |
int | generateId () const |
Getneration unique action identifier. More... | |
Private Attributes | |
ActionList | mySet |
actions list More... | |
Example: Window menu in the MDI application with menu items:
|
private |
QtxActionSet::QtxActionSet | ( | QObject * | parent = 0 | ) |
parent | parent object |
References onChanged().
|
virtual |
|
protected |
|
protectedvirtual |
Reimplemented in QtxActionGroup, and QtxMultiAction.
|
protected |
a | action |
|
protectedvirtual |
Reimplemented in QtxActionGroup, and QtxMultiAction.
References mySet.
|
protectedvirtual |
w | widget this action set is added to |
Reimplemented from QtxAction.
Reimplemented in QtxWorkspaceAction, and QtxWorkstackAction.
References QtxAction::addedTo(), and updateAction().
void QtxActionSet::clear | ( | ) |
An actions list is cleared and all actions are destroyed.
References mySet, and updateAction().
|
private |
References mySet.
If id < 0, it is generated automatically.
a | action being inserted |
id | action ID |
index | position in the action list (if < 0, item is appended to the end of list) |
References actionAdded(), generateId(), mySet, onActionTriggered(), triggered(), and updateAction().
If id < 0, it is generated automatically.
txt | action text |
id | action ID |
index | position in the action list (if < 0, item is appended to the end of list) |
References insertAction(), and QtxAction::QtxAction().
int QtxActionSet::insertAction | ( | const QString & | txt, |
const QIcon & | icon, | ||
const int | id = -1 , |
||
const int | index = -1 |
||
) |
If id < 0, it is generated automatically.
txt | action text |
icon | action icon |
id | action ID |
index | position in the action list (if < 0, item is appended to the end of list) |
References insertAction(), and QtxAction::QtxAction().
lst | list of actions |
index | position in the action list (if < 0, items are appended to the end of list) |
References generateId(), mySet, onActionTriggered(), triggered(), and updateAction().
|
protectedvirtual |
true
if the action itself should be visible Reimplemented in QtxActionGroup, and QtxMultiAction.
|
privateslot |
on | toggled state (not used) |
References actionId(), and triggered().
|
privateslot |
Update action state.
References isEmptyAction().
void QtxActionSet::removeAction | ( | QAction * | a | ) |
An action is removed from the action list and destroyed.
a | action to be removed. |
References actionRemoved(), and mySet.
void QtxActionSet::removeAction | ( | const int | id | ) |
An action is removed from the action list and destroyed.
id | action identifier |
References action(), and removeAction().
|
protectedvirtual |
w | widget this action set is removed from |
Reimplemented from QtxAction.
Reimplemented in QtxWorkspaceAction, and QtxWorkstackAction.
References QtxAction::removedFrom(), and updateAction().
a | action |
id | new action ID |
lst | list of actions |
References insertActions(), and mySet.
|
signal |
action | ID |
|
signal |
a | action being activated |
|
protectedvirtual |
Reimplemented in QtxMultiAction.
|
protectedvirtual |
w | a widget this action is added to |
Reimplemented in QtxActionGroup, and QtxMultiAction.
References mySet.
|
private |