ParameterItem#
- class pyqtgraph.parametertree.ParameterItem(
- param,
- depth=0,
Abstract ParameterTree item. Used to represent the state of a Parameter from within a ParameterTree.
Sets first column of item to name
generates context menu if item is renamable or removable
handles child added / removed events
provides virtual functions for handling changes from parameter
Subclasses that display a value widget may call
makeCtrlButton()to add a ctrl button (gear icon) with a menu that exposes built-in actions (Reset to default, Set as default, Set Enabled/Set Disabled, Set ReadOnly/Set ReadWrite, Rename, Remove). OverridepopulateCtrlMenu()to customise the menu.For more ParameterItem types, see ParameterTree.parameterTypes module.
- columnChangedEvent(
- col,
Called when the text in a column has been edited (or otherwise changed). By default, we only use changes to column 0 to rename the parameter.
- property defaultBtn#
Backward-compatible alias for
ctrlBtn.
- focusNext(
- forward=True,
Give focus to the next (or previous) focusable item in the parameter tree
- makeCtrlButton()[source]#
Create and return the ctrl
CtrlButton.Also sets
self.ctrlBtn(and theself.defaultBtnalias) andself.ctrlMenufor use inpopulateCtrlMenu(). Call once during__init__and add the returned widget to the layout.
- makeDefaultButton()[source]#
Deprecated. Use
makeCtrlButton()instead.
- optsChanged(
- param,
- opts,
Called when any options are changed that are not name, value, default, or limits
- populateCtrlMenu()[source]#
Rebuild the ctrl button menu to reflect current parameter state.
Override in a subclass to add custom entries; call
super().populateCtrlMenu()to retain the built-in actions.Which built-in actions appear is controlled by the
ctrlActionsparameter option (a set of strings, defaultDEFAULT_CTRL_ACTIONS). Valid values are'default','setDefault','enabled','readonly','rename', and'remove'. For'rename'and'remove', either including the key inctrlActionsor settingrenamable=True/removable=Trueon the parameter is sufficient — both are treated as equivalent.'context'actions always follow thecontextparameter option and are not controlled byctrlActions.
- selected(
- sel,
Called when this item has been selected (sel=True) OR deselected (sel=False)
- setFocus()[source]#
Give input focus to this item. Can be reimplemented to display editor widgets, etc.
- treeWidgetChanged()[source]#
Called when this item is added or removed from a tree. Expansion, visibility, and column widgets must all be configured AFTER the item is added to a tree, not during __init__.
- updateCtrlButton()[source]#
Refresh the ctrl button menu to reflect current parameter state.
Called automatically on value and opts changes. Override in a subclass to add custom refresh logic; call
super().updateCtrlButton()to retain the built-in menu refresh.When the menu is currently visible (e.g. a persistent action was just triggered), the rebuild is skipped — individual toggle actions update their own icon and text in-place, and
aboutToShowensures a full refresh the next time the menu opens.
- updateDefaultBtn()[source]#
Deprecated. Use
updateCtrlButton()instead.