Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
QtxMultiAction Class Reference

The class QtxMultiAction implements modifiable action. More...

#include <QtxMultiAction.h>

Inheritance diagram for QtxMultiAction:
Inheritance graph

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...
 
QActionactiveAction () 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 QWidgetcreateWidget (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...
 
QActionaction (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

QActionmyCurrent
 

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

Detailed Description

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.

Constructor & Destructor Documentation

QtxMultiAction::QtxMultiAction ( QObject parent = 0)
Parameters
parentparent object

References onTriggered(), and QtxActionSet::triggered().

QtxMultiAction::QtxMultiAction ( const QString &  txt,
QObject parent = 0 
)
Parameters
txtaction menu text
parentparent object

References onTriggered(), and QtxActionSet::triggered().

QtxMultiAction::QtxMultiAction ( const QIcon &  ico,
const QString &  txt,
QObject parent = 0 
)
Parameters
icoaction menu icon
txtaction menu text
parentparent object

References onTriggered(), and QtxActionSet::triggered().

QtxMultiAction::~QtxMultiAction ( )
virtual

Member Function Documentation

void QtxMultiAction::actionAdded ( QAction a)
protectedvirtual
Parameters
achild action being added

Reimplemented from QtxActionSet.

References onActionChanged().

void QtxMultiAction::actionRemoved ( QAction a)
protectedvirtual
Parameters
achild action being removed

Reimplemented from QtxActionSet.

References myCurrent, onActionChanged(), and updateAction().

QAction * QtxMultiAction::activeAction ( ) const
Returns
current action (0 if there is no active action)

References myCurrent.

QWidget * QtxMultiAction::createWidget ( QWidget parent)
protectedvirtual
Parameters
parentparent widget (should be toolbar)
Returns
toolbar button

References onClicked(), and updateButton().

bool QtxMultiAction::isEmptyAction ( ) const
protectedvirtual
Returns
true if the action itself should be visible

Reimplemented from QtxActionSet.

void QtxMultiAction::onActionChanged ( )
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().

void QtxMultiAction::onClicked ( bool  )
privateslot
Parameters
on(not used)

References myCurrent.

void QtxMultiAction::onTriggered ( QAction a)
privateslot
Parameters
aaction being activated

References myCurrent, and updateAction().

void QtxMultiAction::setActiveAction ( QAction a)
Parameters
aaction to be set current

References QtxActionSet::actions(), myCurrent, and updateAction().

void QtxMultiAction::updateAction ( )
protectedvirtual

Reimplemented from QtxActionSet.

References QtxActionSet::updateAction(), and updateButton().

void QtxMultiAction::updateAction ( QWidget w)
protectedvirtual
Parameters
wwidget menu widget

Reimplemented from QtxActionSet.

References QtxActionSet::updateAction().

void QtxMultiAction::updateButton ( QToolButton btn)
private
Parameters
btntoolbar button

References QtxActionSet::actions(), and myCurrent.

Member Data Documentation

QAction* QtxMultiAction::myCurrent
private

The documentation for this class was generated from the following files: