qmdiActionGroup Class Reference

an abstraction layer for QMenu and QToolBar More...

List of all members.

Public Member Functions

 qmdiActionGroup (QString name)
 Constructs an MDI action group.
 ~qmdiActionGroup ()
void setName (QString name)
 sets an name for this action group
QString getName ()
 returns the name of the action group
void addAction (QAction *action, int location=-1)
 add a new action to the action group
void addActions (QActionGroup *actions, int location=-1)
 add new actions to the action group
void addWidget (QWidget *widget, int location=-1)
 add a new widget to the action group
void addMenu (QMenu *menu, int location=-1)
 adds a submenu to the menu or toolbar
void addSeparator (int location=-1)
 adds a separator to the menu or toolbar
bool containsAction (QAction *action)
 returns if an action is found in this group
void removeAction (QAction *action)
 remove an action from the action group
void removeActions (QActionGroup *actions)
 remove a actions from the action group
void removeMenu (QMenu *menu)
 remove a menu from the action group
void removeWidget (QWidget *widget)
 remove a widget from the action group
void setMergePoint ()
 set the location for menus and toolbar merges
int getMergePoint ()
 compute the best merging point for new action groups
void mergeGroup (qmdiActionGroup *group)
 merges another action group actions into this action group
void unmergeGroup (qmdiActionGroup *group)
 un-merges another action group actions into this action group
QMenu * updateMenu (QMenu *menu=NULL)
 generates an updated menu from the items on the group list
QToolBar * updateToolBar (QToolBar *toolbar)
 generates an updated toolbar from the items on the group list

Public Attributes

bool breakAfter
 Defines if a break should be added after this action group list.


Detailed Description

an abstraction layer for QMenu and QToolBar

This class defines the items that you see on a QMenu and QToolBar, with a much simplified interface. This class has the ability to merge two menus, and thus allowing the new menu to overwrite the actions of the original one.

The action group has a name, which will be used for creating a pop-up menu on a QMenuBar, or setting the toolbar name.

See also:
qmdiActionGroupList

getName


Constructor & Destructor Documentation

qmdiActionGroup::qmdiActionGroup ( QString  name  ) 

Constructs an MDI action group.

Parameters:
name the name of the action group
Default constructor. Builds a new qmdiActionGroup with a give name. The action group will contain no actions by default, representing an empty menu or toolbar.

If you generate a menu from this action group, the name will be used as the title of the menu.

If you generate a toolbar from this action group, the name will be used as title of this toolbar.

See also:
updateMenu()

updateToolBar()

qmdiActionGroup::~qmdiActionGroup (  ) 

Empty destructor. Destroys the object.


Member Function Documentation

void qmdiActionGroup::setName ( QString  name  ) 

sets an name for this action group

Parameters:
name the new name for the action group
Sets the name for the action group. The name will be used for describing the toolbar or menu item, and thus is very important to set it correctly.

See also:
getName

QString qmdiActionGroup::getName (  ) 

returns the name of the action group

Returns:
the name of the action group
Gets the name for the action group. The name will be used for describing the toolbar or menu item, and thus is very important to set it correctly.

void qmdiActionGroup::addAction ( QAction *  action,
int  location = -1 
)

add a new action to the action group

Parameters:
action item to be added to the action group
location where to add the new action
When calling this function, you are adding a new item to the toolbar or menu represented by the action group.

The action is added to the end of the list, if the location parameter is -1, otherwise the location specifies where the actions are added. There is no way to reorder the actions once they are in the group.

See also:
addSeparator

addMenu

containsAction

removeAction

setMergePoint

void qmdiActionGroup::addActions ( QActionGroup *  actions,
int  location = -1 
)

add new actions to the action group

Parameters:
actions items to be added to the action group
location where to add the new actiongroup
Since:
0.0.4
Overloaded function for convience.

See also:
addAction

void qmdiActionGroup::addWidget ( QWidget *  widget,
int  location = -1 
)

add a new widget to the action group

Parameters:
widget item to be added to the action group
location where to add the new widget
When calling this function, you are adding a new widget to the toolbar or menu represented by the action group.

Widget is added to the end of the list if location is -1, otherwise the location specifies where the widget is added. There is no way to reorder the widgets once they are in the group. If you are are generating a menu, this widget is ignored.

See also:
removeWidget

updateMenu

updateToolBar

setMergePoint

void qmdiActionGroup::addMenu ( QMenu *  menu,
int  location = -1 
)

adds a submenu to the menu or toolbar

Parameters:
menu item to be added to the action group
location where to add the new widget
Since:
0.0.4
If you want to add sub menus to some menu bars, you should use this function.

The menu is added to the end of the list if location is -1, otherwise the location specifies where the menu is added.

If you are are generating a toolbar, this menu is ignored.

See also:
updateToolBar

updateMenu

addWidget

setMergePoint

void qmdiActionGroup::addSeparator ( int  location = -1  ) 

adds a separator to the menu or toolbar

Parameters:
location where to add the new widget
This function will add a separator to the menu or toolbar represented by this action group. The separator will be added to the end of the list, unless a location is not -1.

See also:
addAction

removeAction

setMergePoint

bool qmdiActionGroup::containsAction ( QAction *  action  ) 

returns if an action is found in this group

Parameters:
action QAction to be tested
Returns:
true if the action is found in this group action
Use this function for testing if some action is found on the action group.

void qmdiActionGroup::removeAction ( QAction *  action  ) 

remove an action from the action group

Parameters:
action QAction item to be removed
Use this function for removing items from the menu or toolbar represented by this action group.

See also:
addAction

void qmdiActionGroup::removeActions ( QActionGroup *  actions  ) 

remove a actions from the action group

Parameters:
actions items to be removed
Since:
0.0.4
Use this function for removing items from the menu or toolbar represented by this action group.

See also:
removeAction

addAction

void qmdiActionGroup::removeMenu ( QMenu *  menu  ) 

remove a menu from the action group

Parameters:
menu menu item to be removed
Use this function for removing sub-menus from the menu represented by this action group.

See also:
addAction

removeAction

addWidget

addMenu

updateMenu

updateToolBar

void qmdiActionGroup::removeWidget ( QWidget *  widget  ) 

remove a widget from the action group

Parameters:
widget QWidget item to be removed
Use this function for removing widgets from the menu or toolbar represented by this action group.

See also:
addAction

removeAction

addWidget

updateMenu

updateToolBar

void qmdiActionGroup::setMergePoint (  ) 

set the location for menus and toolbar merges

Since:
0.0.3
By default, an action group gets merged to the end of the parent action group. Using this function, you can define a new location to merge new action groups.

int qmdiActionGroup::getMergePoint (  ) 

compute the best merging point for new action groups

Since:
0.0.4
This function computes the best location in which a new action group should be merged. The merge point is computed from the list of merged action groups - the last added action group will win.

If no merging point is defined, the default is to merge at the top of menu or toolbar.

TODO action groups should also have merging priotities

See also:
mergeGroup

void qmdiActionGroup::mergeGroup ( qmdiActionGroup group  ) 

merges another action group actions into this action group

Parameters:
group the new group to be merged
Use this call if you want to merge the items of another group into one. The actions of the new group will be placed at the end of the list of actions available on this, unless a merge location as been defined.

The merge point is calculated from the list of merged action groups or the self defined action group. For more documentation see the documentation of getMergePoint.

See also:
unmergeGroup

setMergePoint

getMergePoint

void qmdiActionGroup::unmergeGroup ( qmdiActionGroup group  ) 

un-merges another action group actions into this action group

Parameters:
group the group to be removed from this group
Use this call if you want to un-merge the items of another group into one.

See also:
mergeGroup

QMenu * qmdiActionGroup::updateMenu ( QMenu *  menu = NULL  ) 

generates an updated menu from the items on the group list

Parameters:
menu a
Returns:
an updated menu
Call this function to update a QMenu from these definitions. If
Parameters:
menu is NULL then a new menu will be allocated.
The returned value is not unallocated by this function, and it's up to the programmer to un-allocate the memory used by the created menu.

If you are inserting that QMenu into a QMenuBar the memory deallocation will be handled by QMenuBar, and you don't have to bother about it.

If the action group contains no items, no menu will be generated, and NULL will be the returned value. If the passed

Parameters:
menu is not NULL it will be deallocated.
See also:
updateToolBar

QToolBar * qmdiActionGroup::updateToolBar ( QToolBar *  toolbar  ) 

generates an updated toolbar from the items on the group list

Parameters:
toolbar the toolbar to update
Returns:
an updated toolbar
Call this function to update a QToolBar from these definitions. If
Parameters:
toolbar is NULL then a new toolbar will be allocated.
The returned value is not unallocated by this function, and it's up to the programmer to un-allocate the memory used by the created menu.

If you are inserting that QToolBar into a QMainWindow the memory deallocation will be handled by QMainWindow, and you don't have to bother about it.

See also:
updateMenu


Member Data Documentation

qmdiActionGroup::breakAfter

Defines if a break should be added after this action group list.

If you set this property to true , and you are generating a toolbar from this action group list, when the toolbar will be displayed for the fist time at the screen a break will be entered after this tool.

This will actually call:

 QMainWindow::addToolBarBreak()


The documentation for this class was generated from the following files:
Generated on Fri Jun 29 21:56:34 2007 for qmdilib by  doxygen 1.5.1