# eric7.EricWidgets.EricModelToolBar

Module implementing a tool bar populated from a QAbstractItemModel.

### Global Attributes

None

### Classes

EricModelToolBar | Class implementing a tool bar populated from a QAbstractItemModel.

### Functions

None

## EricModelToolBar

Class implementing a tool bar populated from a QAbstractItemModel.

### Signals

activated(QModelIndex)
  emitted when an action has been triggered

### Derived from

QToolBar

### Class Attributes

None

### Class Methods

None

### Methods

EricModelToolBar | Constructor
_build | Protected slot to build the tool bar.
_createMenu | Protected method to create the menu for a tool bar action.
dragEnterEvent | Protected method to handle drag enter events.
dropEvent | Protected method to handle drop events.
eventFilter | Public method to handle event for other objects.
hideEvent | Protected method to handle hide events.
index | Public method to get the index of an action.
model | Public method to get a reference to the model.
mouseMoveEvent | Protected method to handle mouse move events.
resetFlags | Public method to reset the saved internal state.
rootIndex | Public method to get the root index.
setModel | Public method to set the model for the tool bar.
setRootIndex | Public method to set the root index.
showEvent | Protected method to handle show events.

### Static Methods

None

#### EricModelToolBar (Constructor)

EricModelToolBar(title=None, parent=None)

Constructor

title
  title for the tool bar (string)
parent
  reference to the parent widget (QWidget)

#### EricModelToolBar._build

_build()

Protected slot to build the tool bar.

#### EricModelToolBar._createMenu

_createMenu()

Protected method to create the menu for a tool bar action.

Return:
  menu for a tool bar action (EricModelMenu)

#### EricModelToolBar.dragEnterEvent

dragEnterEvent(evt)

Protected method to handle drag enter events.

evt
  reference to the event (QDragEnterEvent)

#### EricModelToolBar.dropEvent

dropEvent(evt)

Protected method to handle drop events.

evt
  reference to the event (QDropEvent)

Raises RuntimeError:
  raised to indicate an invalid model index

#### EricModelToolBar.eventFilter

eventFilter(obj, evt)

Public method to handle event for other objects.

obj
  reference to the object (QObject)
evt
  reference to the event (QEvent)

Return:
  flag indicating that the event should be filtered out (boolean)

#### EricModelToolBar.hideEvent

hideEvent(evt)

Protected method to handle hide events.

evt
  reference to the hide event (QHideEvent)

#### EricModelToolBar.index

index(action)

Public method to get the index of an action.

action
  reference to the action to get the index for (QAction)

Return:
  index of the action (QModelIndex)

#### EricModelToolBar.model

model()

Public method to get a reference to the model.

Return:
  reference to the model (QAbstractItemModel)

#### EricModelToolBar.mouseMoveEvent

mouseMoveEvent(evt)

Protected method to handle mouse move events.

evt
  reference to the event (QMouseEvent)

Raises RuntimeError:
  raised to indicate an invalid model index

#### EricModelToolBar.resetFlags

resetFlags()

Public method to reset the saved internal state.

#### EricModelToolBar.rootIndex

rootIndex()

Public method to get the root index.

Return:
  root index (QModelIndex)

#### EricModelToolBar.setModel

setModel(model)

Public method to set the model for the tool bar.

model
  reference to the model (QAbstractItemModel)

#### EricModelToolBar.setRootIndex

setRootIndex(idx)

Public method to set the root index.

idx
  index to be set as the root index (QModelIndex)

#### EricModelToolBar.showEvent

showEvent(evt)

Protected method to handle show events.

evt
  reference to the hide event (QHideEvent)

Up