# eric6.E5Gui.E5ModelToolBar

Module implementing a tool bar populated from a QAbstractItemModel.

### Global Attributes

None

### Classes

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

### Functions

None

## E5ModelToolBar

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

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

#### E5ModelToolBar (Constructor)

E5ModelToolBar(title=None, parent=None)

Constructor

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

#### E5ModelToolBar._build

_build()

Protected slot to build the tool bar.

#### E5ModelToolBar._createMenu

_createMenu()

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

Returns:
  menu for a tool bar action (E5ModelMenu)

#### E5ModelToolBar.dragEnterEvent

dragEnterEvent(evt)

Protected method to handle drag enter events.

evt
  reference to the event (QDragEnterEvent)

#### E5ModelToolBar.dropEvent

dropEvent(evt)

Protected method to handle drop events.

evt
  reference to the event (QDropEvent)

#### E5ModelToolBar.eventFilter

eventFilter(obj, evt)

Public method to handle event for other objects.

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

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

#### E5ModelToolBar.hideEvent

hideEvent(evt)

Protected method to handle hide events.

evt
  reference to the hide event (QHideEvent)

#### E5ModelToolBar.index

index(action)

Public method to get the index of an action.

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

Returns:
  index of the action (QModelIndex)

#### E5ModelToolBar.model

model()

Public method to get a reference to the model.

Returns:
  reference to the model (QAbstractItemModel)

#### E5ModelToolBar.mouseMoveEvent

mouseMoveEvent(evt)

Protected method to handle mouse move events.

evt
  reference to the event (QMouseEvent)

#### E5ModelToolBar.resetFlags

resetFlags()

Public method to reset the saved internal state.

#### E5ModelToolBar.rootIndex

rootIndex()

Public method to get the root index.

Returns:
  root index (QModelIndex)

#### E5ModelToolBar.setModel

setModel(model)

Public method to set the model for the tool bar.

model
  reference to the model (QAbstractItemModel)

#### E5ModelToolBar.setRootIndex

setRootIndex(idx)

Public method to set the root index.

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

#### E5ModelToolBar.showEvent

showEvent(evt)

Protected method to handle show events.

evt
  reference to the hide event (QHideEvent)

Up