# eric4.E4Gui.E4ToolBarManager

Module implementing a toolbar manager class.

### Global Attributes

None

### Classes

E4ToolBarManager | Class implementing a toolbar manager.

### Functions

None

## E4ToolBarManager

Class implementing a toolbar manager.

### Derived from

QObject

### Class Attributes

CustomToolBarMarker
ToolBarMarker
VersionMarker

### Methods

E4ToolBarManager | 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 it's object name.
actionById | Public method to get an action given it's 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 it's 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.
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 it's 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 it's id.
toolBarById | Public method to get a toolbar given it's 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.

#### E4ToolBarManager (Constructor)

E4ToolBarManager(ui = None, parent = None)

Constructor

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

#### E4ToolBarManager.__findAction

__findAction(name)

Private method to find an action by name.

name
  name of the action to search for (string or QString)

Returns:
  reference to the action (QAction)

#### E4ToolBarManager.__findDefaultToolBar

__findDefaultToolBar(name)

Private method to find a default toolbar by name.

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

Returns:
  reference to the default toolbar (QToolBar)

#### E4ToolBarManager.__toolBarByName

__toolBarByName(name)

Private slot to get a toolbar by it's object name.

name
  object name of the toolbar (string or QString)

Returns:
  reference to the toolbar (QToolBar)

#### E4ToolBarManager.actionById

actionById(aID)

Public method to get an action given it's id.

aID
  id of the action object (integer)

Returns:
  reference to the action (QAction)

#### E4ToolBarManager.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 (QString)

#### E4ToolBarManager.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 (QString)

#### E4ToolBarManager.categories

categories()

Public method to get the list of categories.

Returns:
  list of categories (list of string)

#### E4ToolBarManager.categoryActions

categoryActions(category)

Public method to get the actions belonging to a category.

category
  category for the toolbar (string or QString)

Returns:
  list of actions (list of QAction)

#### E4ToolBarManager.createToolBar

createToolBar(title)

Public method to create a custom toolbar.

title
  title to be used for the toolbar (QString)

Returns:
  reference to the created toolbar (QToolBar)

#### E4ToolBarManager.defaultToolBarActions

defaultToolBarActions(tbID)

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

tbID
  id of the default toolbar object (integer)

Returns:
  list of actions (list of QAction)

#### E4ToolBarManager.defaultToolBars

defaultToolBars()

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

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

#### E4ToolBarManager.deleteToolBar

deleteToolBar(toolBar)

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

toolBar
  reference to the toolbar to be managed (QToolBar)

#### E4ToolBarManager.isDefaultToolBar

isDefaultToolBar(toolBar)

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

toolBar
  reference to the toolbar to be checked (QToolBar)

#### E4ToolBarManager.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)

#### E4ToolBarManager.mainWindow

mainWindow()

Public method to get the reference to the main window.

Returns:
  reference to the main window (QMainWindow)

#### E4ToolBarManager.removeAction

removeAction(action)

Public method to remove an action from the manager.

action
  reference to the action to be removed (QAction)

#### E4ToolBarManager.removeToolBar

removeToolBar(toolBar)

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

toolBar
  reference to the toolbar to be removed (QToolBar)

#### E4ToolBarManager.removeWidgetActions

removeWidgetActions(actions)

Public method to remove widget actions.

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

#### E4ToolBarManager.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 (QString)

#### E4ToolBarManager.resetAllToolBars

resetAllToolBars()

Public method to reset all toolbars to their default state.

#### E4ToolBarManager.resetToolBar

resetToolBar(toolBar)

Public method to reset a toolbar to it's default state.

toolBar
  reference to the toolbar to configure (QToolBar)

#### E4ToolBarManager.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)

#### E4ToolBarManager.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)

#### E4ToolBarManager.setMainWindow

setMainWindow(mainWindow)

Public method to set the reference to the main window.

mainWindow
  reference to the main window (QMainWindow)

#### E4ToolBarManager.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)

#### E4ToolBarManager.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

#### E4ToolBarManager.toolBarActions

toolBarActions(tbID)

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

tbID
  id of the toolbar object (integer)

Returns:
  list of actions (list of QAction)

#### E4ToolBarManager.toolBarById

toolBarById(tbID)

Public method to get a toolbar given it's id.

tbID
  id of the toolbar object (integer)

Returns:
  reference to the toolbar (QToolBar)

#### E4ToolBarManager.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)

#### E4ToolBarManager.toolBars

toolBars()

Public method to get all toolbars.

Returns:
  list of all toolbars (list of QToolBar)

#### E4ToolBarManager.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