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

QtxActionMenuMgr Class Reference

Main menu actions manager. More...

#include <QtxActionMenuMgr.h>

Inheritance diagram for QtxActionMenuMgr:
Inheritance graph

Data Structures

class  MenuCreator
 Menu actions creator. More...
class  MenuNode
 Represents a menu item inside main menu structure. More...

Signals

void menuAboutToShow (QMenu *)
 Emitted when the menu is about to be shown.
void menuAboutToHide (QMenu *)
 Emitted when the menu is about to be hidden.

Public Member Functions

 QtxActionMenuMgr (QMainWindow *)
 Constructor.
 QtxActionMenuMgr (QWidget *, QObject *)
 Constructor.
virtual ~QtxActionMenuMgr ()
 Destructor.
QWidgetmenuWidget () const
 Get the menu widget.
virtual bool isVisible (const int, const int) const
 Check if an action with actId identifier is visible to the parent action with place identifier.
virtual void setVisible (const int, const int, const bool)
 Set action's visibility flag.
int insert (const int, const QString &, const int, const int=-1)
 Insert action to the menu.
int insert (QAction *, const QString &, const int, const int=-1)
 Insert action to the menu.
int insert (const int, const QStringList &, const int, const int=-1)
 Insert action to the menu.
int insert (QAction *, const QStringList &, const int, const int=-1)
 Insert action to the menu.
virtual int insert (const int, const int, const int, const int=-1)
 Insert action to the menu.
int insert (QAction *, const int, const int, const int=-1)
 Insert action to the menu.
int insert (const QString &, const QString &, const int, const int=-1, const int=-1)
 Create and insert menu item action to the menu.
int insert (const QString &, const QStringList &, const int, const int=-1, const int=-1)
 Create and insert menu item action to the menu.
virtual int insert (const QString &, const int, const int, const int=-1, const int=-1)
 Create and insert menu item action to the menu.
int append (const int, const int, const int)
 Create and add menu item action to the end of menu.
int append (QAction *, const int, const int)
 Create and add menu item action to the end of menu.
int append (const QString &, const int, const int, const int=-1)
 Create and add menu item action to the end of menu.
int prepend (const int, const int, const int)
 Create and add menu item action to the beginning of menu.
int prepend (QAction *, const int, const int)
 Create and add menu item action to the beginning of menu.
int prepend (const QString &, const int, const int, const int=-1)
 Create and add menu item action to the beginning of menu.
void remove (const int)
 Remove menu item with given id.
void remove (const int, const int, const int=-1)
 Remove menu item with given id.
void show (const int)
 Show menu item with given id.
void hide (const int)
 Hide menu item with given id.
bool isShown (const int) const
 Get visibility status for menu item with given id.
void setShown (const int, const bool)
 Set visibility status for menu item with given id.
virtual void change (const int, const QString &)
 Change menu title for the action with given id.
virtual bool load (const QString &, QtxActionMgr::Reader &)
 Load actions description from the file.
bool containsMenu (const QString &, const int, const bool=false) const
 Check if the parent menu contains menu item with given title.
bool containsMenu (const int, const int, const bool=false) const
 Check if the parent menu contains menu item with given id.
QMenufindMenu (const int) const
 Get menu by the specified identifier.
QMenufindMenu (const QString &, const int, const bool=false) const
 Get menu by the title.
bool isEmptyEnabled (const int) const
 Check if empty menu is enabled.
void setEmptyEnabled (const int, const bool)
 Enable/disable empty menu.
virtual int registerAction (QAction *, const int=-1)
 Register an action in the internal map.
virtual void unRegisterAction (const int)
 Unregister action from internal map.
QActionaction (const int) const
 Get action by specified identifier.
int actionId (const QAction *) const
 Get action identifier.
bool contains (const int) const
 Check if an action with given id is registered in the action manager.
int count () const
 Get total number of registered actions.
bool isEmpty () const
 Check if there are no actions registered in the action manager.
QIntList idList () const
 Get all registered actions identifiers.
bool isUpdatesEnabled () const
 Check if update is enabled.
virtual void setUpdatesEnabled (const bool)
 Enable/disable update operation.
void update ()
 Update actions.
virtual bool isEnabled (const int) const
 Check is action with given id is enabled.
virtual void setEnabled (const int, const bool)

Static Public Member Functions

static QActionseparator (const bool=false)
 Create new separator action.

Protected Member Functions

void setMenuWidget (QWidget *)
 Assign new menu widget to the menu manager.
MenuNodefind (const int, const int, const bool=true) const
 Search menu node.
MenuNodefind (const int, MenuNode *=0, const bool=true) const
 Search menu node.
bool find (const int, NodeList &, MenuNode *=0) const
 Search recursively all menu nodes with given id.
MenuNodefind (const QString &, const int, const bool=true) const
 Search menu node.
MenuNodefind (const QString &, MenuNode *=0, const bool=true) const
 Search menu node.
bool find (const QString &, NodeList &, MenuNode *=0) const
 Search recursively all menu nodes with given title.
int findId (const int, const int=-1) const
 Find menu item by given ID (one-level only).
void removeMenu (const int, MenuNode *)
 Removes menu node (with all its children).
QActionitemAction (const int) const
 Get action by id.
QActionmenuAction (const int) const
 Get submenu action by id.
int menuActionId (QAction *) const
 Get submenu action by id.
void updateMenu (MenuNode *=0, const bool=true, const bool=true)
 Update menu.
virtual void internalUpdate ()
 Internal update.
virtual void updateContent ()
 Called when delayed content update is performed.
int generateId () const
 Generate unique action identifier.
void triggerUpdate ()
 Perform delayed update.

Private Types

typedef QList< MenuNode * > NodeList
 menu nodes list
typedef QMap< int, QAction * > MenuMap
 actions map

Private Slots

void onAboutToShow ()
 Called when the submenu is about to show.
void onAboutToHide ()
 Called when the submenu is about to hide.
void onDestroyed (QObject *)
 Called when the corresponding menu object is destroyed.

Private Member Functions

bool ownAction (QAction *, MenuNode *) const
 Check if action belongs to the menu manager.
bool checkWidget (QWidget *) const
 Check if menu widget has any actions.
QWidgetmenuWidget (MenuNode *) const
 Get menu widget for the given node.
void simplifySeparators (QWidget *)
 Remove extra separators from menu widget.
QString clearTitle (const QString &) const
 Remove special symbols (&) from string to get clear menu title.
int createMenu (const QStringList &, const int)
 Create and inserts menu item recursively.
void triggerUpdate (const int, const bool rec=true)
 Perform delayed menu update.

Private Attributes

MenuNodemyRoot
 root menu node
QWidgetmyMenu
 menu widget
MenuMap myMenus
 actions map
QMap< int, bool > myUpdateIds
 list of actions ID being updated

Detailed Description

Menu manager allows using of set of action for automatic generating of application main menu and dynamic update of its contents.

Use insert(), append() and remove() methods to create main menu. Methods show(), hide() allow displaying/erasing of specified menu items.

Actions can be grouped with help of group identificator. Inside the popup or main menu bar menu items are ordered by the group identifier (ascending).

Menu manager automatically optimizes the menu by removing extra separators, hiding empty popup menus etc.


Member Typedef Documentation

typedef QMap<int, QAction*> QtxActionMenuMgr.MenuMap [private]

Constructor & Destructor Documentation

QtxActionMenuMgr::QtxActionMenuMgr ( QMainWindow p)
Parameters:
pparent main window

References myMenu, and onDestroyed().

QtxActionMenuMgr::QtxActionMenuMgr ( QWidget mw,
QObject p 
)
Parameters:
mwmenu widget
pparent object

References myMenu, and onDestroyed().

QtxActionMenuMgr::~QtxActionMenuMgr ( ) [virtual]

References test_table.a, myMenus, and myRoot.


Member Function Documentation

QWidget * QtxActionMenuMgr::menuWidget ( ) const
Returns:
menu widget (QMenuBar)

References myMenu.

bool QtxActionMenuMgr::isVisible ( const int  actId,
const int  place 
) const [virtual]
Parameters:
actIdaction ID
placesome parent action ID
Returns:
true if an action is visible to the parent
See also:
setVisible()

Reimplemented from QtxActionMgr.

Reimplemented in QtxPopupMgr.

References find(), and QtxActionMenuMgr.MenuNode.visible.

void QtxActionMenuMgr::setVisible ( const int  actId,
const int  place,
const bool  v 
) [virtual]
Parameters:
actIdaction ID
placesome parent action ID
vnew visibility state
See also:
isVisible()

Reimplemented from QtxActionMgr.

References find(), and QtxActionMenuMgr.MenuNode.visible.

int QtxActionMenuMgr::insert ( const int  id,
const QString &  menus,
const int  group,
const int  idx = -1 
)

Insert an action to the named menu. The menus parameter represents the menu name: it can be a sequence of strings, separated by '|' symbol. For example, "File|Edit" means File->Edit submenu. If submenu doesn't exist, it will be created.

Parameters:
idaction ID
menusmenu name
groupgroup ID
idxmenu index inside the menu group
Returns:
action ID
int QtxActionMenuMgr::insert ( QAction a,
const QString &  menus,
const int  group,
const int  idx = -1 
)

Insert an action to the named menu. The menus parameter represents the menu name: it can be a sequence of strings, separated by '|' symbol. For example, "File|Edit" means File->Edit submenu. If submenu doesn't exist, it will be created.

Parameters:
aaction
menusmenu name
groupgroup ID
idxmenu index inside the menu group
Returns:
action ID

References insert().

int QtxActionMenuMgr::insert ( const int  id,
const QStringList &  menus,
const int  group,
const int  idx = -1 
)

Insert an action to the named menu. The menus parameter represents the menu names list. For example, string list consisting from two items "File" and "Edit" means File->Edit submenu. If submenu doesn't exist, it will be created.

Parameters:
idaction ID
menusmenu names list
groupgroup ID
idxmenu index inside the menu group
Returns:
action ID

References createMenu(), and insert().

int QtxActionMenuMgr::insert ( QAction a,
const QStringList &  menus,
const int  group,
const int  idx = -1 
)

Insert an action to the named menu. The menus parameter represents the menu names list. For example, string list consisting from two items "File" and "Edit" means File->Edit submenu. If submenu doesn't exist, it will be created.

Parameters:
aaction
menusmenu names list
groupgroup ID
idxmenu index inside the menu group
Returns:
action ID

References createMenu(), and insert().

int QtxActionMenuMgr::insert ( const int  id,
const int  pId,
const int  group,
const int  idx = -1 
) [virtual]
Parameters:
idaction ID
pIdparent menu action ID
groupgroup ID
idxmenu index inside the menu group
Returns:
action ID

References find(), QtxActionMenuMgr.MenuNode.id, myRoot, and QtxActionMgr.triggerUpdate().

int QtxActionMenuMgr::insert ( QAction a,
const int  pId,
const int  group,
const int  idx = -1 
)
Parameters:
aaction
pIdparent menu action ID
groupgroup ID
idxmenu index inside the menu group
Returns:
action ID

References insert(), and QtxActionMgr.registerAction().

int QtxActionMenuMgr::insert ( const QString &  title,
const QString &  menus,
const int  group,
const int  id = -1,
const int  idx = -1 
)

Insert an action to the named menu. The menus parameter represents the menu name: it can be a sequence of strings, separated by '|' symbol. For example, "File|Edit" means File->Edit submenu. If submenu doesn't exist, it will be created.

Parameters:
titlemenu text
menusmenu name
groupgroup ID
idaction ID
idxmenu index inside the menu group
Returns:
action ID

References insert().

int QtxActionMenuMgr::insert ( const QString &  title,
const QStringList &  menus,
const int  group,
const int  id = -1,
const int  idx = -1 
)

Insert an action to the named menu. The menus parameter represents the menu names list. For example, string list consisting from two items "File" and "Edit" means File->Edit submenu. If submenu doesn't exist, it will be created.

Parameters:
titlemenu text
menusmenu names list
groupgroup ID
idaction ID
idxmenu index inside the menu group
Returns:
action ID

References createMenu(), and insert().

int QtxActionMenuMgr::insert ( const QString &  title,
const int  pId,
const int  group,
const int  id = -1,
const int  idx = -1 
) [virtual]
Parameters:
titlemenu text
pIdparent menu action ID
groupgroup ID
idaction ID
idxmenu index inside the menu group
Returns:
action ID

References QtxActionMenuMgr.MenuNode.children, clearTitle(), find(), QtxActionMgr.generateId(), QtxActionMenuMgr.MenuNode.id, myMenus, myRoot, onAboutToHide(), onAboutToShow(), and QtxActionMgr.triggerUpdate().

int QtxActionMenuMgr::append ( const int  id,
const int  pId,
const int  group 
)
Parameters:
idaction ID
pIdparent menu action ID
groupgroup ID
Returns:
action ID

References insert().

int QtxActionMenuMgr::append ( QAction a,
const int  pId,
const int  group 
)
Parameters:
aaction
pIdparent menu action ID
groupgroup ID
Returns:
action ID

References insert().

int QtxActionMenuMgr::append ( const QString &  title,
const int  pId,
const int  group,
const int  id = -1 
)
Parameters:
titlemenu text
pIdparent menu action ID
groupgroup ID
idaction ID
Returns:
action ID

References insert().

int QtxActionMenuMgr::prepend ( const int  id,
const int  pId,
const int  group 
)
Parameters:
idaction ID
pIdparent menu action ID
groupgroup ID
Returns:
action ID

References insert().

int QtxActionMenuMgr::prepend ( QAction a,
const int  pId,
const int  group 
)
Parameters:
aaction
pIdparent menu action ID
groupgroup ID
Returns:
action ID

References insert().

int QtxActionMenuMgr::prepend ( const QString &  title,
const int  pId,
const int  group,
const int  id = -1 
)
Parameters:
titlemenu text
pIdparent menu action ID
groupgroup ID
idaction ID
Returns:
action ID

References insert().

void QtxActionMenuMgr::remove ( const int  id)
Parameters:
idmenu action ID

References removeMenu(), and QtxActionMgr.update().

void QtxActionMenuMgr::remove ( const int  id,
const int  pId,
const int  group = -1 
)
Parameters:
idmenu action ID
pIdparent menu action ID
groupgroup ID

References QtxActionMenuMgr.MenuNode.children, find(), QtxActionMenuMgr.MenuNode.id, itemAction(), menuAction(), menuWidget(), myMenus, myRoot, and QtxActionMgr.triggerUpdate().

void QtxActionMenuMgr::show ( const int  id)
Parameters:
idmenu action ID
See also:
hide()

References setShown().

void QtxActionMenuMgr::hide ( const int  id)
Parameters:
idmenu action ID
See also:
show()

References setShown().

bool QtxActionMenuMgr::isShown ( const int  id) const
Parameters:
idmenu action ID
Returns:
true if an item is shown
See also:
setShown()

References find(), and QtxActionMenuMgr.MenuNode.visible.

void QtxActionMenuMgr::setShown ( const int  id,
const bool  on 
)
Parameters:
idmenu action ID
onnew visibility status
See also:
isShown()

References find(), QtxActionMenuMgr.MenuNode.id, myRoot, and QtxActionMgr.triggerUpdate().

void QtxActionMenuMgr::change ( const int  id,
const QString &  title 
) [virtual]
Parameters:
idmenu action ID
titlenew menu title

References test_table.a, and menuAction().

bool QtxActionMenuMgr::load ( const QString &  fname,
QtxActionMgr::Reader r 
) [virtual]
Parameters:
fnamefile name
raction reader
Returns:
true on success and false on error

Reimplemented in QtxPopupMgr.

References QtxActionMgr.Reader.read().

bool QtxActionMenuMgr::containsMenu ( const QString &  title,
const int  pid,
const bool  rec = false 
) const
Parameters:
titlemenu title
pidparent menu item ID
Returns:
true if parent menu item contains such child item

References find().

bool QtxActionMenuMgr::containsMenu ( const int  id,
const int  pid,
const bool  rec = false 
) const
Parameters:
idmenu item ID
pidparent menu item ID
Returns:
true if parent menu item contains such child item

References find().

QMenu * QtxActionMenuMgr::findMenu ( const int  id) const
Parameters:
idmenu item ID
Returns:
menu pointer or 0 if menu is not found

References test_table.a, and menuAction().

QMenu * QtxActionMenuMgr::findMenu ( const QString &  title,
const int  pid,
const bool  rec = false 
) const
Parameters:
titlemenu text
pidparent menu item ID (to start search)
recif true, perform recursive update
Returns:
menu pointer or 0 if menu is not found

References test_table.a, find(), QtxActionMenuMgr.MenuNode.id, and menuAction().

bool QtxActionMenuMgr::isEmptyEnabled ( const int  id) const
Parameters:
idmenu item ID
Returns:
true if empty menu is enabled

References QtxActionMenuMgr.MenuNode.emptyEnabled, find(), and menuAction().

void QtxActionMenuMgr::setEmptyEnabled ( const int  id,
const bool  enable 
)
Parameters:
idmenu item ID
enableif true, empty menu will be enabled, otherwise empty menu will be disabled

References QtxActionMenuMgr.MenuNode.emptyEnabled, find(), menuAction(), and updateMenu().

void QtxActionMenuMgr::onAboutToShow ( ) [private, slot]

Emits the signal menuAboutToShow(QMenu*).

References menuAboutToShow().

void QtxActionMenuMgr::onAboutToHide ( ) [private, slot]

Emits the signal menuAboutToHide(QMenu*).

References menuAboutToHide().

void QtxActionMenuMgr::onDestroyed ( QObject obj) [private, slot]

Clears internal pointer to menu to disable crashes.

Parameters:
obj(menu) object being destroyed

References myMenu.

void QtxActionMenuMgr::menuAboutToShow ( QMenu m) [signal]
Parameters:
mmenu being shown
void QtxActionMenuMgr::menuAboutToHide ( QMenu m) [signal]
Parameters:
mmenu being hidden
void QtxActionMenuMgr::setMenuWidget ( QWidget mw) [protected]
Parameters:
mwnew menu widget

References myMenu, onDestroyed(), and QtxActionMgr.triggerUpdate().

QtxActionMenuMgr::MenuNode * QtxActionMenuMgr::find ( const int  id,
const int  pId,
const bool  rec = true 
) const [protected]
Parameters:
idmenu action ID
pIdparent menu item ID
recif true perform recursive search
Returns:
menu node or 0 if it is not found
QtxActionMenuMgr::MenuNode * QtxActionMenuMgr::find ( const int  id,
MenuNode startNode = 0,
const bool  rec = true 
) const [protected]
Parameters:
idmenu action ID
startNodestart menu node (if 0, search from root node)
recif true perform recursive search
Returns:
menu node or 0 if it is not found

References QtxActionMenuMgr.MenuNode.children, find(), and myRoot.

bool QtxActionMenuMgr::find ( const int  id,
NodeList lst,
MenuNode startNode = 0 
) const [protected]
Parameters:
idmenu action ID
NodeListresulting list of menu nodes
startNodestart menu node (if 0, search from root node)
Returns:
true if at least one node is found

References QtxActionMenuMgr.MenuNode.children, find(), QtxActionMenuMgr.MenuNode.id, and myRoot.

QtxActionMenuMgr::MenuNode * QtxActionMenuMgr::find ( const QString &  title,
const int  pId,
const bool  rec = true 
) const [protected]
Parameters:
titlemenu item title
pIdparent menu item ID
recif true perform recursive search
Returns:
menu node or 0 if it is not found

References find().

QtxActionMenuMgr::MenuNode * QtxActionMenuMgr::find ( const QString &  title,
MenuNode startNode = 0,
const bool  rec = true 
) const [protected]
Parameters:
titlemenu item title
startNodestart menu node (if 0, search from root node)
recif true perform recursive search
Returns:
menu node or 0 if it is not found

References test_table.a, QtxActionMenuMgr.MenuNode.children, clearTitle(), find(), itemAction(), menuAction(), and myRoot.

bool QtxActionMenuMgr::find ( const QString &  title,
NodeList lst,
MenuNode startNode = 0 
) const [protected]
Parameters:
titlemenu item title
NodeListresulting list of menu nodes
startNodestart menu node (if 0, search from root node)
Returns:
true if at least one node is found

References test_table.a, QtxActionMenuMgr.MenuNode.children, clearTitle(), find(), itemAction(), menuAction(), and myRoot.

int QtxActionMenuMgr::findId ( const int  id,
const int  pid = -1 
) const [protected]
Parameters:
idmenu action ID
pidparent meun item ID
Returns:
id (>0) on success or -1 if menu item is not found

References QtxActionMenuMgr.MenuNode.children, find(), and myRoot.

void QtxActionMenuMgr::removeMenu ( const int  id,
MenuNode startNode 
) [protected]
Parameters:
idmenu action ID
startNodeparent menu node which search starts from (if 0, search starts from root)

References QtxActionMenuMgr.MenuNode.children, and myRoot.

QAction * QtxActionMenuMgr::itemAction ( const int  id) const [protected]
Parameters:
idaction ID
Returns:
action or 0 if id is invalid

References QtxActionMgr.action().

QAction * QtxActionMenuMgr::menuAction ( const int  id) const [protected]
Parameters:
idsubmenu ID
Returns:
submenu action or 0 if action is not found

References test_table.a, and myMenus.

int QtxActionMenuMgr::menuActionId ( QAction a) const [protected]
Parameters:
idsubmenu ID
Returns:
submenu action or 0 if it is not found

References test_table.a, and myMenus.

void QtxActionMenuMgr::updateMenu ( MenuNode startNode = 0,
const bool  rec = true,
const bool  updParent = true 
) [protected]

Does nothing if update is disabled.

Parameters:
startNodestart menu item to be updated
recif true, perform recursive update
updParentif true update also parent item (without recursion)
See also:
isUpdatesEnabled() and setUpdatesEnabled()

References test_table.a, checkWidget(), QtxActionMenuMgr.MenuNode.children, QtxActionMenuMgr.MenuNode.emptyEnabled, QtxActionMenuMgr.MenuNode.id, QtxActionMgr.isUpdatesEnabled(), isVisible(), itemAction(), menuAction(), menuWidget(), myRoot, ownAction(), QtxActionMenuMgr.MenuNode.parent, and simplifySeparators().

void QtxActionMenuMgr::internalUpdate ( ) [protected, virtual]

Customizes the menu update processing.

Reimplemented from QtxActionMgr.

Reimplemented in QtxPopupMgr.

References QtxActionMgr.isUpdatesEnabled(), myUpdateIds, and updateMenu().

void QtxActionMenuMgr::updateContent ( ) [protected, virtual]

Customizes the content update operation.

Reimplemented from QtxActionMgr.

References find(), myRoot, myUpdateIds, and updateMenu().

bool QtxActionMenuMgr::ownAction ( QAction a,
MenuNode node 
) const [private]
Parameters:
aaction being checked
nodeparent menu node
Returns:
true if action belongs to the menu node

References QtxActionMenuMgr.MenuNode.children, itemAction(), and menuAction().

bool QtxActionMenuMgr::checkWidget ( QWidget wid) const [private]
Parameters:
widwidget to be checked
Returns:
true if widget contains action(s)
QWidget * QtxActionMenuMgr::menuWidget ( MenuNode node) const [private]
Parameters:
nodemenu node
Returns:
popup menu or main menu corresponding to the menu node (or 0 if it is not found)

References QtxActionMenuMgr.MenuNode.id, myMenu, myMenus, and myRoot.

void QtxActionMenuMgr::simplifySeparators ( QWidget wid) [private]
Parameters:
widmenu widget to be processed
QString QtxActionMenuMgr::clearTitle ( const QString &  txt) const [private]
Parameters:
txtstring to be processed
Returns:
clear title
int QtxActionMenuMgr::createMenu ( const QStringList &  lst,
const int  pId 
) [private]
Parameters:
lstlist of menu names
pIdparent menu item ID
Returns:
created menu item ID (last in the chain)

References insert().

void QtxActionMenuMgr::triggerUpdate ( const int  id,
const bool  rec = true 
) [private]
Parameters:
idmenu item ID
recif true, perform recursive update

References myUpdateIds, and QtxActionMgr.triggerUpdate().

int QtxActionMgr::registerAction ( QAction a,
const int  userId = -1 
) [virtual, inherited]

If userId is less than 0, the identifier for the action is generated automatically. If action with given userId is already registered, it will be re-registered.

Parameters:
aaction to be registered
userIdaction ID
Returns:
action ID (the same as userId or generated one)
See also:
unRegisterAction()

References QtxActionMgr.actionId(), QtxActionMgr.contains(), QtxActionMgr.generateId(), QtxActionMgr.myActions, and QtxActionMgr.unRegisterAction().

void QtxActionMgr::unRegisterAction ( const int  id) [virtual, inherited]
Parameters:
idaction ID
See also:
registerAction()

Reimplemented in QtxPopupMgr.

References QtxActionMgr.contains(), and QtxActionMgr.myActions.

QAction * QtxActionMgr::action ( const int  id) const [inherited]
Parameters:
idaction ID
Returns:
action (or 0 if id is invalid)
See also:
actionId()

References QtxActionMgr.contains(), and QtxActionMgr.myActions.

int QtxActionMgr::actionId ( const QAction a) const [inherited]
Parameters:
aaction
Returns:
action ID (or -1 if action is not found)
See also:
action()

References test_table.a, and QtxActionMgr.myActions.

bool QtxActionMgr::contains ( const int  id) const [inherited]
Parameters:
idaction ID
Returns:
true if internal map contains action with such identifier

References QtxActionMgr.myActions.

int QtxActionMgr::count ( ) const [inherited]
Returns:
number of actions in the internal map
See also:
isEmpty()

References QtxActionMgr.myActions.

bool QtxActionMgr::isEmpty ( ) const [inherited]
Returns:
true if internal map is empty
See also:
count()

References QtxActionMgr.myActions.

QIntList QtxActionMgr::idList ( ) const [inherited]
Returns:
list of actions identifiers

References QtxActionMgr.myActions.

bool QtxActionMgr::isUpdatesEnabled ( ) const [inherited]
Returns:
true if update is enabled
See also:
setUpdatesEnabled(), update()

References QtxActionMgr.myUpdate.

void QtxActionMgr::setUpdatesEnabled ( const bool  upd) [virtual, inherited]
Parameters:
updnew state
See also:
isUpdatesEnabled(), update()

References QtxActionMgr.myUpdate.

void QtxActionMgr::update ( ) [inherited]

Calls virtual function internalUpdate to update the contents. Does nothing if update is disabled.

See also:
setUpdatesEnabled(), isUpdatesEnabled(), internalUpdate()

References QtxActionMgr.internalUpdate(), QtxActionMgr.isUpdatesEnabled(), and QtxActionMgr.myUpdTimer.

bool QtxActionMgr::isEnabled ( const int  id) const [virtual, inherited]
Parameters:
idaction ID
Returns:
true if action is enabled

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

void QtxActionMgr::setEnabled ( const int  id,
const bool  enable 
) [virtual, inherited]

Enable/disable action with given id.

Parameters:
idaction ID
enablenew state

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

QAction * QtxActionMgr::separator ( const bool  own = false) [static, inherited]

If own is true, then the caller is responsible for the action destroying. If own is false, new separator action will be owned by the action manager which will destroy it on application exit.

Parameters:
ownownership flag
Returns:
new separator action

References test_table.a, and qtxSeparatorActionCleanup().

int QtxActionMgr::generateId ( ) const [protected, inherited]
Returns:
new ID
void QtxActionMgr::triggerUpdate ( ) [protected, inherited]

Field Documentation

QMap<int, bool> QtxActionMenuMgr.myUpdateIds [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