Home ⌂Doc Index ◂Up ▴

eric6.E5Gui.E5ModelMenu

Module implementing a menu populated from a QAbstractItemModel.

Global Attributes

None

Classes

E5ModelMenu Class implementing a menu populated from a QAbstractItemModel.

Functions

None


E5ModelMenu

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

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

E5ModelMenu (Constructor)

E5ModelMenu(parent=None)

Constructor

parent
reference to the parent widget (QWidget)

E5ModelMenu.__aboutToShow

__aboutToShow()

Private slot to show the menu.

E5ModelMenu.__actionTriggered

__actionTriggered(action)

Private slot to handle the triggering of an action.

action
reference to the action that was triggered (QAction)

E5ModelMenu.__makeAction

__makeAction(idx)

Private method to create an action.

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

E5ModelMenu.createBaseMenu

createBaseMenu()

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

Returns:
reference to the menu (E5ModelMenu)

E5ModelMenu.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
index of the parent item (QModelIndex)
max_
maximum number of entries (integer)
parentMenu
reference to the parent menu (QMenu)
menu
reference to the menu to be populated (QMenu)

E5ModelMenu.dragEnterEvent

dragEnterEvent(evt)

Protected method to handle drag enter events.

evt
reference to the event (QDragEnterEvent)

E5ModelMenu.dropEvent

dropEvent(evt)

Protected method to handle drop events.

evt
reference to the event (QDropEvent)

E5ModelMenu.firstSeparator

firstSeparator()

Public method to get the first separator.

Returns:
row number of the first separator (integer)

E5ModelMenu.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)

E5ModelMenu.makeAction

makeAction(icon, text, parent)

Public method to create an action.

icon
icon of the action (QIcon)
text
text of the action (string)
parent
reference to the parent object (QObject)
Returns:
reference to the created action (QAction)

E5ModelMenu.maxRows

maxRows()

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

Returns:
maximum number of entries to show (integer)

E5ModelMenu.model

model()

Public method to get a reference to the model.

Returns:
reference to the model (QAbstractItemModel)

E5ModelMenu.mouseMoveEvent

mouseMoveEvent(evt)

Protected method to handle mouse move events.

evt
reference to the event (QMouseEvent)

E5ModelMenu.mousePressEvent

mousePressEvent(evt)

Protected method handling mouse press events.

evt
reference to the event object (QMouseEvent)

E5ModelMenu.mouseReleaseEvent

mouseReleaseEvent(evt)

Protected method handling mouse release events.

evt
reference to the event object (QMouseEvent)

E5ModelMenu.postPopulated

postPopulated()

Public method to add any actions after the tree.

E5ModelMenu.prePopulated

prePopulated()

Public method to add any actions before the tree.

Returns:
flag indicating if any actions were added

E5ModelMenu.removeEntry

removeEntry(idx)

Public method to remove a menu entry.

idx
index of the entry to be removed (QModelIndex)

E5ModelMenu.resetFlags

resetFlags()

Public method to reset the saved internal state.

E5ModelMenu.rootIndex

rootIndex()

Public method to get the index of the root item.

Returns:
index of the root item (QModelIndex)

E5ModelMenu.separatorRole

separatorRole()

Public method to get the role of the separator.

Returns:
role of the separator (integer)

E5ModelMenu.setFirstSeparator

setFirstSeparator(offset)

Public method to set the first separator.

offset
row number of the first separator (integer)

E5ModelMenu.setMaxRows

setMaxRows(rows)

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

rows
maximum number of entries to show (integer)

E5ModelMenu.setModel

setModel(model)

Public method to set the model for the menu.

model
reference to the model (QAbstractItemModel)

E5ModelMenu.setRootIndex

setRootIndex(index)

Public method to set the index of the root item.

index
index of the root item (QModelIndex)

E5ModelMenu.setSeparatorRole

setSeparatorRole(role)

Public method to set the role of the separator.

role
role of the separator (integer)

E5ModelMenu.setStatusBarTextRole

setStatusBarTextRole(role)

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

role
role of the status bar text (integer)

E5ModelMenu.statusBarTextRole

statusBarTextRole()

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

Returns:
role of the status bar text (integer)
Up



Home ⌂Doc Index ◂Up ▴