Version: 6.3.1
Data Structures | Public Member Functions | Protected Member Functions | Private Attributes

QtxAction Class Reference

Generic action class. More...

#include <QtxAction.h>

Inheritance diagram for QtxAction:
Inheritance graph

Data Structures

class  ActionNotify
 Notify event used to signalize about event adding/removing. More...

Public Member Functions

 QtxAction (QObject *=0, bool=false, const QString &=QString())
 Constructor.
 QtxAction (const QString &, const QString &, int, QObject *, bool=false, const QString &=QString())
 Constructor.
 QtxAction (const QString &, const QIcon &, const QString &, int, QObject *, bool=false, const QString &=QString())
 Constructor.
virtual ~QtxAction ()
 Destructor.
virtual bool eventFilter (QObject *, QEvent *)
 Customize action events.
QString shortcutActionName () const
 Return shortcut action name for the action.
void setShortcutActionName (const QString &)
 Set shortcut action name to the action.

Protected Member Functions

virtual void addedTo (QWidget *)
 Called when the action is added to the widget.
virtual void removedFrom (QWidget *)
 Called when the action is removed from the widget.
virtual void customEvent (QEvent *)
 Process notification events.

Private Attributes

QString myShortcutActionName

Detailed Description

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.


Constructor & Destructor Documentation

QtxAction::QtxAction ( QObject parent = 0,
bool  toggle = false,
const QString &  shortcutAction = QString() 
)

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.

Parameters:
parentparent object
toggleif true the action will be a toggle action
shortcutActionshortcut action identifier

References setShortcutActionName().

QtxAction::QtxAction ( const QString &  text,
const QString &  menuText,
int  accel,
QObject parent,
bool  toggle = false,
const QString &  shortcutAction = QString() 
)

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.

Parameters:
texttooltip text
menuTextmenu text
accelshortcut key sequence
parentparent object
toggleif true the action is a toggle action
shortcutActionshortcut 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() 
)

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.

Parameters:
texttooltip text
iconiconset
menuTextmenu text
accelshortcut key sequence
parentparent object
toggleif true the action will be a toggle action
shortcutActionshortcut action identifier

References setShortcutActionName().

QtxAction::~QtxAction ( ) [virtual]

Member Function Documentation

bool QtxAction::eventFilter ( QObject o,
QEvent e 
) [virtual]

Sends a notification event to the action when it is added to the widget or removed from it in order to perform custom processing.

Parameters:
oobject
eevent
Returns:
true if further event processing should be stopped
See also:
customEvent(), addedTo(), removedFrom()
QString QtxAction::shortcutActionName ( ) const
Returns:
shortcut action name
See also:
setShortcutActionName()

References myShortcutActionName.

void QtxAction::setShortcutActionName ( const QString &  shortcutAction)

Shortcut action name is used for shortcuts customization.

Parameters:
shortcutActionshortcut action name
See also:
shortcutActionName()

References myShortcutActionName.

void QtxAction::addedTo ( QWidget ) [protected, virtual]

This method can be redefined in the subclasses to customize the action behavior. Base implementation does nothing.

Parameters:
wwidget (should be menu or toolbar)
See also:
removedFrom()

Reimplemented in LightApp_ModuleAction, QtxActionSet, QtxDockAction, QtxWorkspaceAction, and QtxWorkstackAction.

void QtxAction::removedFrom ( QWidget ) [protected, virtual]

This method can be redefined in the subclasses to customize the action behavior. Base implementation does nothing.

Parameters:
wwidget (should be menu or toolbar)
See also:
addedTo()

Reimplemented in LightApp_ModuleAction, QtxActionSet, QtxDockAction, QtxWorkspaceAction, and QtxWorkstackAction.

void QtxAction::customEvent ( QEvent e) [protected, virtual]

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.

Parameters:
enoification event
See also:
eventFilter(), addedTo(), removedFrom()

References addedTo(), QtxAction.ActionNotify.isAdded(), removedFrom(), and QtxAction.ActionNotify.widget().


Field Documentation

QString QtxAction.myShortcutActionName [private]
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS