Version: 6.3.1
Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes

QtxWorkspaceAction Class Reference

Implements actions group for menu Windows with standard operations, like "Cascade", "Tile", "Tile Horizontally", etc.

#include <QtxWorkspaceAction.h>

Inheritance diagram for QtxWorkspaceAction:
Inheritance graph

Public Types

enum  {
  Cascade = 0x0001, Tile = 0x0002, VTile = 0x0004, HTile = 0x0008,
  Windows = 0x0010, Standard = Cascade | Tile | Windows, Operations = Cascade | Tile | VTile | HTile, All = Standard | HTile | VTile
}
 

Actions (menu items) ID.

More...

Public Slots

void tile ()
 Tile child windows in the workspace.
void cascade ()
 Cascade child windows in the workspace.
void tileVertical ()
 Tile child windows in the workspace in the vertical direction.
void tileHorizontal ()
 Tile child windows in the workspace in the horizontal direction.

Signals

void triggered (int)
 Emitted when some child action is activated by the user.
void triggered (QAction *)
 Emitted when some child action is activated by the user.

Public Member Functions

 QtxWorkspaceAction (QtxWorkspace *, QObject *=0)
 Constructor.
virtual ~QtxWorkspaceAction ()
 Destructor.
QtxWorkspaceworkspace () const
 Get workspace.
int menuActions () const
 Get menu actions which are currently visible in the menu bar.
void setMenuActions (const int)
 Set actions to be visible in the menu.
QIcon icon (const int) const
 Get icon for the specified action.
QString text (const int) const
 Get menu item text for the specified action.
int accel (const int) const
 Get keyboard accelerator for the specified action.
QString statusTip (const int) const
 Get status bar tip for the specified action.
void setAccel (const int, const int)
 Set keyboard accelerator for the specified action.
void setIcon (const int, const QIcon &)
 Set menu item icon for the specified action.
void setText (const int, const QString &)
 Set menu item text for the specified action.
void setStatusTip (const int, const QString &)
 Set menu item status bar tip for the specified action.
void perform (const int)
 Process action activated by the user.
QList< QAction * > actions () const
 Get list of child actions.
void setActions (const QList< QAction * > &)
 Assign child actions.
void insertActions (const QList< QAction * > &, const int=-1)
 Insert actions at the specified position.
int insertAction (QAction *, const int id=-1, const int=-1)
 Insert action at the specified position.
int insertAction (const QString &, const int id=-1, const int=-1)
 Insert action at the specified position.
int insertAction (const QString &, const QIcon &, const int id=-1, const int=-1)
 Insert action at the specified position.
void removeAction (QAction *)
 Remove specified action.
void removeAction (const int)
 Remove specified action.
void clear ()
 Remove all actions.
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 action is added to the menu bar.
virtual void removedFrom (QWidget *)
 Called when action is removed from the menu bar.
virtual void actionAdded (QAction *)
 Notify that action was added.
virtual void actionRemoved (QAction *)
 Notify that action was removed.
QActionaction (int) const
 Get action by specified identifier.
int actionId (QAction *) const
 Get action identifier for the action.
void setActionId (QAction *, const int)
 Set action identifier for the action.
virtual bool isEmptyAction () const
 Check if the action itself should be invisible (only child action are shown)
virtual void updateAction ()
 Update action set.
virtual void updateAction (QWidget *)
 Update action set for the specified widget.
virtual void customEvent (QEvent *)
 Process notification events.

Private Slots

void onAboutToShow ()
 Called when parent menu is about to show.
void onTriggered (int)
 Called when menu item is activated by the user.

Private Member Functions

void updateContent ()
 Update all menu action state.
void updateWindows ()
 Update actions which refer to the opened child windows.
void activateItem (const int)
 Called when menu item corresponding to some child window is activated.

Private Attributes

QtxWorkspacemyWorkspace
 parent workspace
bool myWindowsFlag
 "show child windows items" flag

Member Enumeration Documentation

anonymous enum
Enumerator:
Cascade 

"Cascade child windows" operation

Tile 

"Tile child windows" operation

VTile 

"Tile child windows vertically" operation

HTile 

"Tile child windows horizontally" operation

Windows 

A list of child windows menu items.

Standard 
Operations 
All 

Constructor & Destructor Documentation

QtxWorkspaceAction::QtxWorkspaceAction ( QtxWorkspace ws,
QObject parent = 0 
)
Parameters:
wsparent workspace
parentparent object (owner of the action)

References Cascade, HTile, QtxActionSet.insertAction(), onTriggered(), QtxAction.QtxAction(), setMenuActions(), Standard, Tile, QtxActionSet.triggered(), and VTile.

QtxWorkspaceAction::~QtxWorkspaceAction ( ) [virtual]

Member Function Documentation

QtxWorkspace * QtxWorkspaceAction::workspace ( ) const
Returns:
parent workspace

References myWorkspace.

int QtxWorkspaceAction::menuActions ( ) const
Returns:
ORed together actions flags
See also:
setMenuActions()

References QtxActionSet.action(), Cascade, HTile, myWindowsFlag, TestSalomeApp.ret, Tile, VTile, and Windows.

void QtxWorkspaceAction::setMenuActions ( const int  flags)

Actions, which IDs are set in flags parameter, will be shown in the menu bar. Other actions will not be shown.

Parameters:
flagsORed together actions flags

References QtxActionSet.action(), Cascade, HTile, myWindowsFlag, Tile, VTile, and Windows.

QIcon QtxWorkspaceAction::icon ( const int  id) const

If id is invalid, null icon is returned.

Parameters:
idmenu action ID
Returns:
menu item icon

References QtxActionSet.action().

QString QtxWorkspaceAction::text ( const int  id) const
Parameters:
idmenu action ID
Returns:
menu item text or null QString if there is no such action

References QtxActionSet.action().

int QtxWorkspaceAction::accel ( const int  id) const
Parameters:
idmenu action ID
Returns:
keyboard accelerator of menu item or 0 if there is no such action

References test_table.a, and QtxActionSet.action().

QString QtxWorkspaceAction::statusTip ( const int  id) const
Parameters:
idmenu action ID
Returns:
status bar tip menu item or null QString if there is no such action

References QtxActionSet.action().

void QtxWorkspaceAction::setAccel ( const int  id,
const int  a 
)
Parameters:
idmenu action ID
anew keyboard accelerator

References QtxActionSet.action().

void QtxWorkspaceAction::setIcon ( const int  id,
const QIcon &  icon 
)
Parameters:
idmenu action ID
iconew menu item icon

References QtxActionSet.action().

void QtxWorkspaceAction::setText ( const int  id,
const QString &  txt 
)
Parameters:
idmenu action ID
txtnew menu item text

References QtxActionSet.action().

void QtxWorkspaceAction::setStatusTip ( const int  id,
const QString &  txt 
)
Parameters:
idmenu action ID
txtnew menu item status bar tip

References QtxActionSet.action().

void QtxWorkspaceAction::perform ( const int  type)
Parameters:
typeaction ID

References cascade(), Cascade, HTile, tile(), Tile, tileHorizontal(), tileVertical(), and VTile.

void QtxWorkspaceAction::tile ( ) [slot]

References workspace().

void QtxWorkspaceAction::cascade ( ) [slot]

References workspace().

void QtxWorkspaceAction::tileVertical ( ) [slot]
void QtxWorkspaceAction::tileHorizontal ( ) [slot]
void QtxWorkspaceAction::onAboutToShow ( ) [private, slot]

Updates all menu items.

References updateContent().

void QtxWorkspaceAction::onTriggered ( int  id) [private, slot]

Perform the corresponding action.

Parameters:
idmenu item identifier

References activateItem(), perform(), and Windows.

void QtxWorkspaceAction::addedTo ( QWidget w) [protected, virtual]
Parameters:
wmenu bar widget this action is being added to

Reimplemented from QtxActionSet.

References onAboutToShow().

void QtxWorkspaceAction::removedFrom ( QWidget w) [protected, virtual]
Parameters:
wmenu bar widget this action is being removed from

Reimplemented from QtxActionSet.

References onAboutToShow().

void QtxWorkspaceAction::updateContent ( ) [private]
void QtxWorkspaceAction::updateWindows ( ) [private]
void QtxWorkspaceAction::activateItem ( const int  idx) [private]

Activates correposponding child window.

Parameters:
idxmenu item index

References workspace().

QList< QAction * > QtxActionSet::actions ( ) const [inherited]
Returns:
list of assigned actions

References QtxActionSet.mySet.

void QtxActionSet::setActions ( const QList< QAction * > &  lst) [inherited]
Parameters:
lstlist of actions

References QtxActionSet.insertActions(), and QtxActionSet.mySet.

void QtxActionSet::insertActions ( const QList< QAction * > &  lst,
const int  index = -1 
) [inherited]
Parameters:
lstlist of actions
indexposition in the action list (if < 0, items are appended to the end of list)

References test_table.a, QtxActionSet.generateId(), QtxActionSet.mySet, QtxActionSet.onActionTriggered(), QtxActionSet.triggered(), and QtxActionSet.updateAction().

int QtxActionSet::insertAction ( QAction a,
const int  id = -1,
const int  index = -1 
) [inherited]

If id < 0, it is generated automatically.

Parameters:
aaction being inserted
idaction ID
indexposition in the action list (if < 0, item is appended to the end of list)
Returns:
action identifier

References QtxActionSet.actionAdded(), QtxActionSet.generateId(), QtxActionSet.mySet, QtxActionSet.onActionTriggered(), QtxActionSet.triggered(), and QtxActionSet.updateAction().

int QtxActionSet::insertAction ( const QString &  txt,
const int  id = -1,
const int  index = -1 
) [inherited]

If id < 0, it is generated automatically.

Parameters:
txtaction text
idaction ID
indexposition in the action list (if < 0, item is appended to the end of list)
Returns:
action identifier

References QtxActionSet.insertAction(), and QtxAction.QtxAction().

int QtxActionSet::insertAction ( const QString &  txt,
const QIcon &  icon,
const int  id = -1,
const int  index = -1 
) [inherited]

If id < 0, it is generated automatically.

Parameters:
txtaction text
iconaction icon
idaction ID
indexposition in the action list (if < 0, item is appended to the end of list)
Returns:
action identifier

References QtxActionSet.insertAction(), and QtxAction.QtxAction().

void QtxActionSet::removeAction ( QAction a) [inherited]

An action is removed from the action list and destroyed.

Parameters:
aaction to be removed.

References test_table.a, QtxActionSet.actionRemoved(), and QtxActionSet.mySet.

void QtxActionSet::removeAction ( const int  id) [inherited]

An action is removed from the action list and destroyed.

Parameters:
idaction identifier

References QtxActionSet.action(), and QtxActionSet.removeAction().

void QtxActionSet::clear ( ) [inherited]

An actions list is cleared and all actions are destroyed.

References QtxActionSet.mySet, and QtxActionSet.updateAction().

void QtxActionSet::triggered ( int  id) [signal, inherited]
Parameters:
actionID
void QtxActionSet::triggered ( QAction a) [signal, inherited]
Parameters:
aaction being activated
void QtxActionSet::actionAdded ( QAction ) [protected, virtual, inherited]

Reimplemented in QtxActionGroup, and QtxMultiAction.

void QtxActionSet::actionRemoved ( QAction ) [protected, virtual, inherited]

Reimplemented in QtxActionGroup, and QtxMultiAction.

QAction * QtxActionSet::action ( int  id) const [protected, inherited]
Parameters:
idaction ID
Returns:
action or 0 if it is not found

References test_table.a, QtxActionSet.actionId(), and QtxActionSet.mySet.

int QtxActionSet::actionId ( QAction a) const [protected, inherited]
Parameters:
aaction
Returns:
action ID or -1 if it is not found
void QtxActionSet::setActionId ( QAction a,
const int  id 
) [protected, inherited]
Parameters:
aaction
idnew action ID
bool QtxActionSet::isEmptyAction ( ) const [protected, virtual, inherited]
Returns:
true if the action itself should be visible

Reimplemented in QtxActionGroup, and QtxMultiAction.

void QtxActionSet::updateAction ( ) [protected, virtual, inherited]

Reimplemented in QtxMultiAction.

void QtxActionSet::updateAction ( QWidget w) [protected, virtual, inherited]
Parameters:
wa widget this action is added to

Reimplemented in QtxActionGroup, and QtxMultiAction.

References test_table.a, and QtxActionSet.mySet.

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

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 [inherited]
Returns:
shortcut action name
See also:
setShortcutActionName()

References QtxAction.myShortcutActionName.

void QtxAction::setShortcutActionName ( const QString &  shortcutAction) [inherited]

Shortcut action name is used for shortcuts customization.

Parameters:
shortcutActionshortcut action name
See also:
shortcutActionName()

References QtxAction.myShortcutActionName.

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

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 QtxAction.addedTo(), QtxAction.ActionNotify.isAdded(), QtxAction.removedFrom(), and QtxAction.ActionNotify.widget().


Field Documentation

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