Generic action class. More...
#include <QtxAction.h>
Classes | |
class | ActionNotify |
Notify event used to signalize about event adding/removing. More... | |
Public Member Functions | |
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 the action is added to the widget. More... | |
virtual void | removedFrom (QWidget *) |
Called when the action is removed from the widget. More... | |
virtual void | customEvent (QEvent *) |
Process notification events. More... | |
Private Attributes | |
QString | myShortcutActionName |
Generic action class.
The class QtxAction inherits QWidgetAction class and can be used as base class when implementing any custom menu/toolbar actions. It is necessary to subclass from QtxAction and redefine virtual callback methods addedTo(), removedFrom() (which are called automatically when the action is added to the widget and removed from it) to customize the action behavior.
QtxAction::QtxAction | ( | QObject * | parent = 0 , |
bool | toggle = false , |
||
const QString & | shortcutAction = QString() |
||
) |
Constructor.
Creates an action owned by parent. Parameter toggle can be used to make the action checkable. Parameter shortcutAction can be used to assign the shortcut from preferences. This parameter value corresponds to shortcut action identifier in shortcut preferences.
parent | parent object |
toggle | if true the action will be a toggle action |
shortcutAction | shortcut action identifier |
References setShortcutActionName().
QtxAction::QtxAction | ( | const QString & | text, |
const QString & | menuText, | ||
int | accel, | ||
QObject * | parent, | ||
bool | toggle = false , |
||
const QString & | shortcutAction = QString() |
||
) |
Constructor.
Creates an action owned by parent. Parameters text, menuText and accel specify the action's attributes. Parameter toggle can be used to make the action checkable. Parameter shortcutAction can be used to assign the shortcut from preferences. This parameter value corresponds to shortcut action identifier in shortcut preferences.
text | tooltip text |
menuText | menu text |
accel | shortcut key sequence |
parent | parent object |
toggle | if true the action is a toggle action |
shortcutAction | shortcut action identifier |
References setShortcutActionName().
QtxAction::QtxAction | ( | const QString & | text, |
const QString & | menuText, | ||
const QKeySequence & | accel, | ||
QObject * | parent, | ||
bool | toggle = false , |
||
const QString & | shortcutAction = QString() |
||
) |
Constructor.
Creates an action owned by parent. Parameters text, menuText and accel specify the action's attributes. Parameter toggle can be used to make the action checkable. Parameter shortcutAction can be used to assign the shortcut from preferences. This parameter value corresponds to shortcut action identifier in shortcut preferences.
text | tooltip text |
menuText | menu text |
accel | shortcut key sequence |
parent | parent object |
toggle | if true the action is a toggle action |
shortcutAction | shortcut action identifier |
References setShortcutActionName().
QtxAction::QtxAction | ( | const QString & | text, |
const QIcon & | icon, | ||
const QString & | menuText, | ||
int | accel, | ||
QObject * | parent, | ||
bool | toggle = false , |
||
const QString & | shortcutAction = QString() |
||
) |
Constructor.
Creates an action owned by parent. Parameters text, icon, menuText and accel specify the action's attributes. Parameter toggle can be used to make the action checkable. Parameter shortcutAction can be used to assign the shortcut from preferences. This parameter value corresponds to shortcut action identifier in shortcut preferences.
text | tooltip text |
icon | iconset |
menuText | menu text |
accel | shortcut key sequence |
parent | parent object |
toggle | if true the action will be a toggle action |
shortcutAction | shortcut action identifier |
References setShortcutActionName().
QtxAction::QtxAction | ( | const QString & | text, |
const QIcon & | icon, | ||
const QString & | menuText, | ||
const QKeySequence & | accel, | ||
QObject * | parent, | ||
bool | toggle = false , |
||
const QString & | shortcutAction = QString() |
||
) |
Constructor.
Creates an action owned by parent. Parameters text, icon, menuText and accel specify the action's attributes. Parameter toggle can be used to make the action checkable. Parameter shortcutAction can be used to assign the shortcut from preferences. This parameter value corresponds to shortcut action identifier in shortcut preferences.
text | tooltip text |
icon | iconset |
menuText | menu text |
accel | shortcut key sequence |
parent | parent object |
toggle | if true the action will be a toggle action |
shortcutAction | shortcut action identifier |
References setShortcutActionName().
|
virtual |
Destructor.
|
protectedvirtual |
Called when the action is added to the widget.
This method can be redefined in the subclasses to customize the action behavior. Base implementation does nothing.
w | widget (should be menu or toolbar) |
Reimplemented in QtxWorkstackAction, QtxWorkspaceAction, QtxDockAction, QtxActionSet, and LightApp_ModuleAction.
|
protectedvirtual |
Process notification events.
Calls addedTo() method when the action is added to the widget and removedFrom() when it is removed from the widget in order to perform custom processing.
e | noification event |
References addedTo(), QtxAction::ActionNotify::isAdded(), removedFrom(), and QtxAction::ActionNotify::widget().
Customize action events.
Sends a notification event to the action when it is added to the widget or removed from it in order to perform custom processing.
o | object |
e | event |
true
if further event processing should be stopped
|
protectedvirtual |
Called when the action is removed from the widget.
This method can be redefined in the subclasses to customize the action behavior. Base implementation does nothing.
w | widget (should be menu or toolbar) |
Reimplemented in QtxWorkstackAction, QtxWorkspaceAction, QtxDockAction, QtxActionSet, and LightApp_ModuleAction.
void QtxAction::setShortcutActionName | ( | const QString & | shortcutAction | ) |
Set shortcut action name to the action.
Shortcut action name is used for shortcuts customization.
shortcutAction | shortcut action name |
References myShortcutActionName.
QString QtxAction::shortcutActionName | ( | ) | const |
Return shortcut action name for the action.
References myShortcutActionName.
|
private |