eric7.EricWidgets.EricModelMenu

Module implementing a menu populated from a QAbstractItemModel.

Global Attributes

None

Classes

EricModelMenu Class implementing a menu populated from a QAbstractItemModel.

Functions

None


EricModelMenu

Class implementing a menu populated from a QAbstractItemModel.

Signals

activated(QModelIndex)
emitted when an action has been triggered

Derived from

QMenu

Class Attributes

None

Class Methods

None

Methods

EricModelMenu Constructor
__aboutToShow Private slot to show the menu.
__actionTriggered Private slot to handle the triggering of an action.
__makeAction Private method to create an action.
clear Public method to clear the menu.
createBaseMenu Public method to get the menu that is used to populate sub menu's.
createMenu Public method to put all the children of a parent into a menu of a given length.
dragEnterEvent Protected method to handle drag enter events.
dropEvent Protected method to handle drop events.
firstSeparator Public method to get the first separator.
index Public method to get the index of an action.
makeAction Public method to create an action.
maxRows Public method to get the maximum number of entries to show.
model Public method to get a reference to the model.
mouseMoveEvent Protected method to handle mouse move events.
mousePressEvent Protected method handling mouse press events.
mouseReleaseEvent Protected method handling mouse release events.
postPopulated Public method to add any actions after the tree.
prePopulated Public method to add any actions before the tree.
removeEntry Public method to remove a menu entry.
resetFlags Public method to reset the saved internal state.
rootIndex Public method to get the index of the root item.
separatorRole Public method to get the role of the separator.
setFirstSeparator Public method to set the first separator.
setMaxRows Public method to set the maximum number of entries to show.
setModel Public method to set the model for the menu.
setRootIndex Public method to set the index of the root item.
setSeparatorRole Public method to set the role of the separator.
setStatusBarTextRole Public method to set the role of the status bar text.
statusBarTextRole Public method to get the role of the status bar text.

Static Methods

None

EricModelMenu (Constructor)

EricModelMenu(parent=None)

Constructor

parent (QWidget)
reference to the parent widget

EricModelMenu.__aboutToShow

__aboutToShow()

Private slot to show the menu.

EricModelMenu.__actionTriggered

__actionTriggered(action)

Private slot to handle the triggering of an action.

action (QAction)
reference to the action that was triggered

EricModelMenu.__makeAction

__makeAction(idx)

Private method to create an action.

idx (QModelIndex)
index of the item to create an action for
Return:
reference to the created action
Return Type:
QAction

EricModelMenu.clear

clear()

Public method to clear the menu.

EricModelMenu.createBaseMenu

createBaseMenu()

Public method to get the menu that is used to populate sub menu's.

Return:
reference to the menu
Return Type:
EricModelMenu

EricModelMenu.createMenu

createMenu(parent, max_, parentMenu=None, menu=None)

Public method to put all the children of a parent into a menu of a given length.

parent (QModelIndex)
index of the parent item
max_ (int)
maximum number of entries
parentMenu (QMenu)
reference to the parent menu
menu (QMenu)
reference to the menu to be populated

EricModelMenu.dragEnterEvent

dragEnterEvent(evt)

Protected method to handle drag enter events.

evt (QDragEnterEvent)
reference to the event

EricModelMenu.dropEvent

dropEvent(evt)

Protected method to handle drop events.

evt (QDropEvent)
reference to the event

EricModelMenu.firstSeparator

firstSeparator()

Public method to get the first separator.

Return:
row number of the first separator
Return Type:
int

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

EricModelMenu.makeAction

makeAction(icon, text, parent)

Public method to create an action.

icon (QIcon)
icon of the action
text (str)
text of the action
parent (QObject)
reference to the parent object
Return:
reference to the created action
Return Type:
QAction

EricModelMenu.maxRows

maxRows()

Public method to get the maximum number of entries to show.

Return:
maximum number of entries to show
Return Type:
int

EricModelMenu.model

model()

Public method to get a reference to the model.

Return:
reference to the model
Return Type:
QAbstractItemModel

EricModelMenu.mouseMoveEvent

mouseMoveEvent(evt)

Protected method to handle mouse move events.

evt (QMouseEvent)
reference to the event

EricModelMenu.mousePressEvent

mousePressEvent(evt)

Protected method handling mouse press events.

evt (QMouseEvent)
reference to the event object

EricModelMenu.mouseReleaseEvent

mouseReleaseEvent(evt)

Protected method handling mouse release events.

evt (QMouseEvent)
reference to the event object

EricModelMenu.postPopulated

postPopulated()

Public method to add any actions after the tree.

EricModelMenu.prePopulated

prePopulated()

Public method to add any actions before the tree.

Return:
flag indicating if any actions were added
Return Type:
bool

EricModelMenu.removeEntry

removeEntry(idx)

Public method to remove a menu entry.

idx (QModelIndex)
index of the entry to be removed

EricModelMenu.resetFlags

resetFlags()

Public method to reset the saved internal state.

EricModelMenu.rootIndex

rootIndex()

Public method to get the index of the root item.

Return:
index of the root item
Return Type:
QModelIndex

EricModelMenu.separatorRole

separatorRole()

Public method to get the role of the separator.

Return:
role of the separator
Return Type:
int

EricModelMenu.setFirstSeparator

setFirstSeparator(offset)

Public method to set the first separator.

offset (int)
row number of the first separator

EricModelMenu.setMaxRows

setMaxRows(rows)

Public method to set the maximum number of entries to show.

rows (int)
maximum number of entries to show

EricModelMenu.setModel

setModel(model)

Public method to set the model for the menu.

model (QAbstractItemModel)
reference to the model

EricModelMenu.setRootIndex

setRootIndex(index)

Public method to set the index of the root item.

index (QModelIndex)
index of the root item

EricModelMenu.setSeparatorRole

setSeparatorRole(role)

Public method to set the role of the separator.

role (int)
role of the separator

EricModelMenu.setStatusBarTextRole

setStatusBarTextRole(role)

Public method to set the role of the status bar text.

role (int)
role of the status bar text

EricModelMenu.statusBarTextRole

statusBarTextRole()

Public method to get the role of the status bar text.

Return:
role of the status bar text
Return Type:
int
Up