Implements actions group for menu Windows with standard operations, like "Split vertical", "Split horizontal", etc.
#include <QtxWorkstackAction.h>

Public Types | |
| enum | { SplitVertical = 0x0001, SplitHorizontal = 0x0002, Windows = 0x0010, Split = SplitVertical | SplitHorizontal, Standard = Split | Windows } |
Actions (menu items) ID. More... | |
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 | |
| QtxWorkstackAction (QtxWorkstack *, QObject *=0) | |
| Constructor. | |
| virtual | ~QtxWorkstackAction () |
| Destructor. | |
| QtxWorkstack * | workstack () const |
| Get workstack. | |
| 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. | |
| QAction * | action (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 | splitVertical () |
| Split the window area in the workstack in the vertical direction. | |
| void | splitHorizontal () |
| Split the window area in the workstack in the horizontal direction. | |
| void | activateItem (const int) |
| Called when menu item corresponding to some child window is activated. | |
Private Attributes | |
| QtxWorkstack * | myWorkstack |
| parent workstack | |
| bool | myWindowsFlag |
| "show child windows items" flag | |
| anonymous enum |
| QtxWorkstackAction::QtxWorkstackAction | ( | QtxWorkstack * | ws, |
| QObject * | parent = 0 |
||
| ) |
| ws | workstack |
| parent | parent object (owner of the action) |
References QtxWorkstack.action(), QtxActionSet.insertAction(), myWorkstack, onTriggered(), QtxAction.QtxAction(), setMenuActions(), SplitHorizontal, QtxWorkstack.SplitHorizontal, SplitVertical, QtxWorkstack.SplitVertical, Standard, and QtxActionSet.triggered().
| QtxWorkstackAction::~QtxWorkstackAction | ( | ) | [virtual] |
| QtxWorkstack * QtxWorkstackAction::workstack | ( | ) | const |
References myWorkstack.
| int QtxWorkstackAction::menuActions | ( | ) | const |
References QtxActionSet.action(), myWindowsFlag, TestSalomeApp.ret, SplitHorizontal, SplitVertical, and Windows.
| void QtxWorkstackAction::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.
| flags | ORed together actions flags |
References QtxActionSet.action(), myWindowsFlag, SplitHorizontal, SplitVertical, and Windows.
| QIcon QtxWorkstackAction::icon | ( | const int | id | ) | const |
If id is invalid, null icon is returned.
| id | menu action ID |
References QtxActionSet.action().
| QString QtxWorkstackAction::text | ( | const int | id | ) | const |
| id | menu action ID |
References QtxActionSet.action().
| int QtxWorkstackAction::accel | ( | const int | id | ) | const |
| id | menu action ID |
References test_table.a, and QtxActionSet.action().
| QString QtxWorkstackAction::statusTip | ( | const int | id | ) | const |
| id | menu action ID |
References QtxActionSet.action().
| void QtxWorkstackAction::setAccel | ( | const int | id, |
| const int | a | ||
| ) |
| id | menu action ID |
| a | new keyboard accelerator |
References QtxActionSet.action().
| void QtxWorkstackAction::setIcon | ( | const int | id, |
| const QIcon & | icon | ||
| ) |
| id | menu action ID |
| ico | new menu item icon |
References QtxActionSet.action().
| void QtxWorkstackAction::setText | ( | const int | id, |
| const QString & | txt | ||
| ) |
| id | menu action ID |
| txt | new menu item text |
References QtxActionSet.action().
| void QtxWorkstackAction::setStatusTip | ( | const int | id, |
| const QString & | txt | ||
| ) |
| id | menu action ID |
| txt | new menu item status bar tip |
References QtxActionSet.action().
| void QtxWorkstackAction::perform | ( | const int | type | ) |
| type | action ID |
| void QtxWorkstackAction::onAboutToShow | ( | ) | [private, slot] |
Updates all menu items.
References updateContent().
| void QtxWorkstackAction::onTriggered | ( | int | id | ) | [private, slot] |
Perform the corresponding action.
| id | menu item identifier |
References activateItem(), perform(), and Windows.
| void QtxWorkstackAction::addedTo | ( | QWidget * | w | ) | [protected, virtual] |
| w | menu bar widget this action is being added to |
Reimplemented from QtxActionSet.
References onAboutToShow().
| void QtxWorkstackAction::removedFrom | ( | QWidget * | w | ) | [protected, virtual] |
| w | menu bar widget this action is being removed from |
Reimplemented from QtxActionSet.
References onAboutToShow().
| void QtxWorkstackAction::updateContent | ( | ) | [private] |
| void QtxWorkstackAction::updateWindows | ( | ) | [private] |
References test_table.a, QtxActionSet.action(), QtxActionSet.actionId(), QtxActionSet.actions(), QtxWorkstack.activeWindow(), QtxActionSet.insertActions(), menuActions(), QtxAction.QtxAction(), QtxActionSet.removeAction(), QtxActionSet.setActionId(), SplitHorizontal, SplitVertical, QtxWorkstack.windowList(), Windows, and workstack().
| void QtxWorkstackAction::splitVertical | ( | ) | [private] |
References QtxWorkstack.splitVertical(), and workstack().
| void QtxWorkstackAction::splitHorizontal | ( | ) | [private] |
References QtxWorkstack.splitHorizontal(), and workstack().
| void QtxWorkstackAction::activateItem | ( | const int | idx | ) | [private] |
Activates correposponding child window.
| idx | menu item index |
References QtxWorkstack.windowList(), and workstack().
References QtxActionSet.mySet.
| lst | list of actions |
References QtxActionSet.insertActions(), and QtxActionSet.mySet.
| void QtxActionSet::insertActions | ( | const QList< QAction * > & | lst, |
| const int | index = -1 |
||
| ) | [inherited] |
| lst | list of actions |
| index | position 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.
| a | action being inserted |
| id | action ID |
| index | position in the action list (if < 0, item is appended to the end of list) |
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.
| txt | action text |
| id | action ID |
| index | position in the action list (if < 0, item is appended to the end of list) |
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.
| txt | action text |
| icon | action icon |
| id | action ID |
| index | position in the action list (if < 0, item is appended to the end of list) |
References QtxActionSet.insertAction(), and QtxAction.QtxAction().
| void QtxActionSet::removeAction | ( | QAction * | a | ) | [inherited] |
An action is removed from the action list and destroyed.
| a | action 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.
| id | action 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] |
| action | ID |
| void QtxActionSet::triggered | ( | QAction * | a | ) | [signal, inherited] |
| a | action 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] |
| id | action ID |
References test_table.a, QtxActionSet.actionId(), and QtxActionSet.mySet.
| int QtxActionSet::actionId | ( | QAction * | a | ) | const [protected, inherited] |
| a | action |
| void QtxActionSet::setActionId | ( | QAction * | a, |
| const int | id | ||
| ) | [protected, inherited] |
| a | action |
| id | new action ID |
| bool QtxActionSet::isEmptyAction | ( | ) | const [protected, virtual, inherited] |
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] |
| w | a widget this action is added to |
Reimplemented in QtxActionGroup, and QtxMultiAction.
References test_table.a, and QtxActionSet.mySet.
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 | QString QtxAction::shortcutActionName | ( | ) | const [inherited] |
References QtxAction.myShortcutActionName.
| void QtxAction::setShortcutActionName | ( | const QString & | shortcutAction | ) | [inherited] |
Shortcut action name is used for shortcuts customization.
| shortcutAction | shortcut action name |
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.
| e | noification event |
References QtxAction.addedTo(), QtxAction.ActionNotify.isAdded(), QtxAction.removedFrom(), and QtxAction.ActionNotify.widget().
QtxWorkstack* QtxWorkstackAction.myWorkstack [private] |
bool QtxWorkstackAction.myWindowsFlag [private] |