DictModelQMenu

Documentation

class qconcurrency.widgets.DictModelQMenu(dictmodel, menustyle=’submenu’, indexinfo={‘id’: ‘_id’, ’name’: ‘name’})[source]

Bases: PySide.QtGui.QMenu

QMenu, whose actions/submenus are based/rebuilt from a DictModel. There are 2x display methods:

  • indented: every DictModelRow in the model is
    a action. Items in nested-tables are indented, and positioned under their parent.
  • submenu: DictModelRow s that contain
    child-tables are presented as submenus. Only bottom-level DictModelRow items are actions.

Example

../_images/qconcurrency.widgets.DictModelQMenu_indented.png

menustyle='indented'

../_images/qconcurrency.widgets.DictModelQMenu_submenu.png

menustyle='submenu'

__init__(dictmodel, menustyle=’submenu’, indexinfo={‘id’: ‘_id’, ’name’: ‘name’})[source]
dictmodel (DictModel):
The model whose contents we are using to generate the popup menu contents. Nested tables will appear in sub-menus.
menustyle (str, optional): (ex: 'submenu', 'indented' )

This argument determines how to handle nested tables in the DictModel.

  • submenu: each item containing children will be implemented
    in the menu as a submenu. Only the items from the bottom-most nested-table can be selected.
  • indented: every item is selectable, child items are merely
    indented to indicate that they are children of their parent.
indexinfo (dict, optional): (ex:  {'id':'_id', 'name': 'name'} )

A dictionary containing the keys id and name. The value of these keys represent the name (appears in qmenu) and it’s corresponding databaseId.

The values of these keys are column-names from the dictmodel. See DictModel.__init__()

staticMetaObject = <PySide.QtCore.QMetaObject object>
triggered_row = <PySide.QtCore.Signal object>