# 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 (str)
  title for the tool bar
parent (QWidget)
  reference to the parent widget

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

Return Type:
  EricModelMenu

#### EricModelToolBar.dragEnterEvent

dragEnterEvent(evt)

Protected method to handle drag enter events.

evt (QDragEnterEvent)
  reference to the event

#### EricModelToolBar.dropEvent

dropEvent(evt)

Protected method to handle drop events.

evt (QDropEvent)
  reference to the event

Raises RuntimeError:
  raised to indicate an invalid model index

#### EricModelToolBar.eventFilter

eventFilter(obj, evt)

Public method to handle event for other objects.

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

Return:
  flag indicating that the event should be filtered out

Return Type:
  bool

#### EricModelToolBar.hideEvent

hideEvent(evt)

Protected method to handle hide events.

evt (QHideEvent)
  reference to the hide event

#### EricModelToolBar.index

index(action)

Public method to get the index of an action.

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

Return:
  index of the action

Return Type:
  QModelIndex

#### EricModelToolBar.model

model()

Public method to get a reference to the model.

Return:
  reference to the model

Return Type:
  QAbstractItemModel

#### EricModelToolBar.mouseMoveEvent

mouseMoveEvent(evt)

Protected method to handle mouse move events.

evt (QMouseEvent)
  reference to the event

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

Return Type:
  QModelIndex

#### EricModelToolBar.setModel

setModel(model)

Public method to set the model for the tool bar.

model (QAbstractItemModel)
  reference to the model

#### EricModelToolBar.setRootIndex

setRootIndex(idx)

Public method to set the root index.

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

#### EricModelToolBar.showEvent

showEvent(evt)

Protected method to handle show events.

evt (QHideEvent)
  reference to the hide event

Up