# eric4.E4Gui.E4ModelToolBar

Module implementing a tool bar populated from a QAbstractItemModel.

### Global Attributes

None

### Classes

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

### Functions

None

## E4ModelToolBar

Class implementing a tool bar populated from a QAbstractItemModel.

### Derived from

QToolBar

### Class Attributes

None

### Methods

E4ModelToolBar | 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.

#### E4ModelToolBar (Constructor)

E4ModelToolBar(title = None, parent = None)

Constructor

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

#### E4ModelToolBar._build

_build()

Protected slot to build the tool bar.

#### E4ModelToolBar._createMenu

_createMenu()

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

Returns:
  menu for a tool bar action (E4ModelMenu)

#### E4ModelToolBar.dragEnterEvent

dragEnterEvent(evt)

Protected method to handle drag enter events.

evt
  reference to the event (QDragEnterEvent)

#### E4ModelToolBar.dropEvent

dropEvent(evt)

Protected method to handle drop events.

evt
  reference to the event (QDropEvent)

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

#### E4ModelToolBar.hideEvent

hideEvent(evt)

Protected method to handle hide events.

evt
  reference to the hide event (QHideEvent)

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

#### E4ModelToolBar.model

model()

Public method to get a reference to the model.

Returns:
  reference to the model (QAbstractItemModel)

#### E4ModelToolBar.mouseMoveEvent

mouseMoveEvent(evt)

Protected method to handle mouse move events.

evt
  reference to the event (QMouseEvent)

#### E4ModelToolBar.resetFlags

resetFlags()

Public method to reset the saved internal state.

#### E4ModelToolBar.rootIndex

rootIndex()

Public method to get the root index.

Returns:
  root index (QModelIndex)

#### E4ModelToolBar.setModel

setModel(model)

Public method to set the model for the tool bar.

model
  reference to the model (QAbstractItemModel)

#### E4ModelToolBar.setRootIndex

setRootIndex(idx)

Public method to set the root index.

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

#### E4ModelToolBar.showEvent

showEvent(evt)

Protected method to handle show events.

evt
  reference to the hide event (QHideEvent)

Up