The class QtxMultiAction implements modifiable action. More...
#include <QtxMultiAction.h>
Classes | |
class | Button |
Custom button to be used in the toolbar. More... | |
class | Filter |
Waches for the buttons in the popup menu to update the tool buttons state. More... | |
class | Menu |
Custom menu to be used with the toolbuttons as drop down list. More... | |
Public Member Functions | |
QtxMultiAction (QObject *parent=0) | |
Constructor. More... | |
QtxMultiAction (const QString &, QObject *parent=0) | |
Constructor. More... | |
QtxMultiAction (const QIcon &, const QString &, QObject *parent=0) | |
Constructor. More... | |
virtual | ~QtxMultiAction () |
Destructor. More... | |
void | setActiveAction (QAction *) |
Set current action. More... | |
QAction * | activeAction () const |
Get current action. More... | |
Public Member Functions inherited from QtxActionSet | |
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 bool | isEmptyAction () const |
Check if the action itself should be invisible (only child action are shown) More... | |
virtual QWidget * | createWidget (QWidget *) |
Create widget to be displayed in the toolbar. More... | |
virtual void | updateAction () |
Update action. More... | |
virtual void | updateAction (QWidget *) |
Update child (popup menu) action. More... | |
virtual void | actionAdded (QAction *) |
Called when the child action is added to this action. More... | |
virtual void | actionRemoved (QAction *) |
Called when the child action is removed from this action. More... | |
Protected Member Functions inherited from QtxActionSet | |
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... | |
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... | |
Protected Member Functions inherited from QtxAction | |
virtual void | customEvent (QEvent *) |
Process notification events. More... | |
Private Slots | |
void | onClicked (bool) |
Called when the user activates the current action (for example by clicking the tool button). More... | |
void | onTriggered (QAction *) |
Called when user activates any action from the dropdown menu. More... | |
void | onActionChanged () |
Called when any child action is enabled/disabled. More... | |
Private Member Functions | |
void | updateButton (QToolButton *) |
Update toolbar button. More... | |
Private Attributes | |
QAction * | myCurrent |
Additional Inherited Members | |
Signals inherited from QtxActionSet | |
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... | |
The QtxMultiAction class provides a possibility to assign a set of actions (insertAction() function). The action can be used in the toolbar (and even in the menu) to show drop-down menu with the list of the assigned actions.
Initially the first action from the list becomes current and it is activated when the tool button is clicked by the user. If user presses and holds the mouse button at the tool button, it shows the popup menu with all the assigned actions. When the user selects any action from the popup menu, it becames current.
QtxMultiAction::QtxMultiAction | ( | QObject * | parent = 0 | ) |
parent | parent object |
References onTriggered(), and QtxActionSet::triggered().
txt | action menu text |
parent | parent object |
References onTriggered(), and QtxActionSet::triggered().
ico | action menu icon |
txt | action menu text |
parent | parent object |
References onTriggered(), and QtxActionSet::triggered().
|
virtual |
|
protectedvirtual |
|
protectedvirtual |
a | child action being removed |
Reimplemented from QtxActionSet.
References myCurrent, onActionChanged(), and updateAction().
QAction * QtxMultiAction::activeAction | ( | ) | const |
References myCurrent.
parent | parent widget (should be toolbar) |
References onClicked(), and updateButton().
|
protectedvirtual |
true
if the action itself should be visible Reimplemented from QtxActionSet.
|
privateslot |
If the current action is disabled, the multi-action switches to first found enabled. If all child actions are disabled, the action itself is also disabled.
References QtxActionSet::actions(), myCurrent, and updateAction().
|
privateslot |
on | (not used) |
References myCurrent.
|
privateslot |
a | action being activated |
References myCurrent, and updateAction().
void QtxMultiAction::setActiveAction | ( | QAction * | a | ) |
a | action to be set current |
References QtxActionSet::actions(), myCurrent, and updateAction().
|
protectedvirtual |
Reimplemented from QtxActionSet.
References QtxActionSet::updateAction(), and updateButton().
|
protectedvirtual |
w | widget menu widget |
Reimplemented from QtxActionSet.
References QtxActionSet::updateAction().
|
private |
btn | toolbar button |
References QtxActionSet::actions(), and myCurrent.
|
private |