# eric6.E5Gui.E5ToolBarManager

Module implementing a toolbar manager class.

### Global Attributes

None

### Classes

E5ToolBarManager | Class implementing a toolbar manager.

### Functions

None

## E5ToolBarManager

Class implementing a toolbar manager.

### Derived from

QObject

### Class Attributes

CustomToolBarMarker
ToolBarMarker
VersionMarker

### Class Methods

None

### Methods

E5ToolBarManager | Constructor
__findAction | Private method to find an action by name.
__findDefaultToolBar | Private method to find a default toolbar by name.
__toolBarByName | Private slot to get a toolbar by its object name.
actionById | Public method to get an action given its id.
addAction | Public method to add an action to be managed.
addToolBar | Public method to add a toolbar to be managed.
categories | Public method to get the list of categories.
categoryActions | Public method to get the actions belonging to a category.
createToolBar | Public method to create a custom toolbar.
defaultToolBarActions | Public method to get a default toolbar's actions given its id.
defaultToolBars | Public method to get all toolbars added with addToolBar().
deleteToolBar | Public method to remove a custom toolbar created with createToolBar().
isDefaultToolBar | Public method to check, if a toolbar was added with addToolBar().
isWidgetAction | Public method to check, if action is a widget action.
mainWindow | Public method to get the reference to the main window.
removeAction | Public method to remove an action from the manager.
removeCategoryActions | Public method to remove the actions belonging to a category.
removeToolBar | Public method to remove a toolbar added with addToolBar().
removeWidgetActions | Public method to remove widget actions.
renameToolBar | Public method to give a toolbar a new title.
resetAllToolBars | Public method to reset all toolbars to their default state.
resetToolBar | Public method to reset a toolbar to its default state.
restoreState | Public method to restore the state of the toolbar manager.
saveState | Public method to save the state of the toolbar manager.
setMainWindow | Public method to set the reference to the main window.
setToolBar | Public method to set the actions of a toolbar.
setToolBars | Public method to set the actions of several toolbars.
toolBarActions | Public method to get a toolbar's actions given its id.
toolBarById | Public method to get a toolbar given its id.
toolBarWidgetAction | Public method to get the toolbar for a widget action.
toolBars | Public method to get all toolbars.
toolBarsActions | Public method to get all toolbars and their actions.

### Static Methods

None

#### E5ToolBarManager (Constructor)

E5ToolBarManager(ui=None, parent=None)

Constructor

ui
  reference to the user interface object (UI.UserInterface)
parent
  reference to the parent object (QObject)

#### E5ToolBarManager.__findAction

__findAction(name)

Private method to find an action by name.

name
  name of the action to search for (string)

Returns:
  reference to the action (QAction)

#### E5ToolBarManager.__findDefaultToolBar

__findDefaultToolBar(name)

Private method to find a default toolbar by name.

name
  name of the default toolbar to search for (string)

Returns:
  reference to the default toolbar (QToolBar)

#### E5ToolBarManager.__toolBarByName

__toolBarByName(name)

Private slot to get a toolbar by its object name.

name
  object name of the toolbar (string)

Returns:
  reference to the toolbar (QToolBar)

#### E5ToolBarManager.actionById

actionById(aID)

Public method to get an action given its id.

aID
  id of the action object (integer)

Returns:
  reference to the action (QAction)

#### E5ToolBarManager.addAction

addAction(action, category)

Public method to add an action to be managed.

action
  reference to the action to be managed (QAction)
category
  category for the toolbar (string)

#### E5ToolBarManager.addToolBar

addToolBar(toolBar, category)

Public method to add a toolbar to be managed.

toolBar
  reference to the toolbar to be managed (QToolBar)
category
  category for the toolbar (string)

#### E5ToolBarManager.categories

categories()

Public method to get the list of categories.

Returns:
  list of categories (list of string)

#### E5ToolBarManager.categoryActions

categoryActions(category)

Public method to get the actions belonging to a category.

category
  category for the actions (string)

Returns:
  list of actions (list of QAction)

#### E5ToolBarManager.createToolBar

createToolBar(title, name="")

Public method to create a custom toolbar.

title
  title to be used for the toolbar (string)
name
  optional name for the new toolbar (string)

Returns:
  reference to the created toolbar (QToolBar)

#### E5ToolBarManager.defaultToolBarActions

defaultToolBarActions(tbID)

Public method to get a default toolbar's actions given its id.

tbID
  id of the default toolbar object (integer)

Returns:
  list of actions (list of QAction)

#### E5ToolBarManager.defaultToolBars

defaultToolBars()

Public method to get all toolbars added with addToolBar().

Returns:
  list of all default toolbars (list of QToolBar)

#### E5ToolBarManager.deleteToolBar

deleteToolBar(toolBar)

Public method to remove a custom toolbar created with createToolBar().

toolBar
  reference to the toolbar to be managed (QToolBar)

#### E5ToolBarManager.isDefaultToolBar

isDefaultToolBar(toolBar)

Public method to check, if a toolbar was added with addToolBar().

toolBar
  reference to the toolbar to be checked (QToolBar)

Returns:
  flag indicating an added toolbar (boolean)

#### E5ToolBarManager.isWidgetAction

isWidgetAction(action)

Public method to check, if action is a widget action.

action
  reference to the action to be checked (QAction)

Returns:
  flag indicating a widget action (boolean)

#### E5ToolBarManager.mainWindow

mainWindow()

Public method to get the reference to the main window.

Returns:
  reference to the main window (QMainWindow)

#### E5ToolBarManager.removeAction

removeAction(action)

Public method to remove an action from the manager.

action
  reference to the action to be removed (QAction)

#### E5ToolBarManager.removeCategoryActions

removeCategoryActions(category)

Public method to remove the actions belonging to a category.

category
  category for the actions (string)

#### E5ToolBarManager.removeToolBar

removeToolBar(toolBar)

Public method to remove a toolbar added with addToolBar().

toolBar
  reference to the toolbar to be removed (QToolBar)

#### E5ToolBarManager.removeWidgetActions

removeWidgetActions(actions)

Public method to remove widget actions.

actions
  dictionary with toolbar id as key and a list of widget actions as value

#### E5ToolBarManager.renameToolBar

renameToolBar(toolBar, title)

Public method to give a toolbar a new title.

toolBar
  reference to the toolbar to be managed (QToolBar)
title
  title to be used for the toolbar (string)

#### E5ToolBarManager.resetAllToolBars

resetAllToolBars()

Public method to reset all toolbars to their default state.

#### E5ToolBarManager.resetToolBar

resetToolBar(toolBar)

Public method to reset a toolbar to its default state.

toolBar
  reference to the toolbar to configure (QToolBar)

#### E5ToolBarManager.restoreState

restoreState(state, version=0)

Public method to restore the state of the toolbar manager.

state
  byte array containing the saved state (QByteArray)
version
  version number stored with the data (integer)

Returns:
  flag indicating success (boolean)

#### E5ToolBarManager.saveState

saveState(version=0)

Public method to save the state of the toolbar manager.

version
  version number stored with the data (integer)

Returns:
  saved state as a byte array (QByteArray)

#### E5ToolBarManager.setMainWindow

setMainWindow(mainWindow)

Public method to set the reference to the main window.

mainWindow
  reference to the main window (QMainWindow)

#### E5ToolBarManager.setToolBar

setToolBar(toolBar, actions)

Public method to set the actions of a toolbar.

toolBar
  reference to the toolbar to configure (QToolBar)
actions
  list of actions to be set (list of QAction)

#### E5ToolBarManager.setToolBars

setToolBars(toolBars)

Public method to set the actions of several toolbars.

toolBars
  dictionary with toolbar id as key and a list of actions as value

#### E5ToolBarManager.toolBarActions

toolBarActions(tbID)

Public method to get a toolbar's actions given its id.

tbID
  id of the toolbar object (integer)

Returns:
  list of actions (list of QAction)

#### E5ToolBarManager.toolBarById

toolBarById(tbID)

Public method to get a toolbar given its id.

tbID
  id of the toolbar object (integer)

Returns:
  reference to the toolbar (QToolBar)

#### E5ToolBarManager.toolBarWidgetAction

toolBarWidgetAction(action)

Public method to get the toolbar for a widget action.

action
  widget action to check for (QAction)

Returns:
  reference to the toolbar containing action (QToolBar)

#### E5ToolBarManager.toolBars

toolBars()

Public method to get all toolbars.

Returns:
  list of all toolbars (list of QToolBar)

#### E5ToolBarManager.toolBarsActions

toolBarsActions()

Public method to get all toolbars and their actions.

Returns:
  reference to dictionary of toolbar IDs as key and list of actions as values

Up