Class: QgsActionMenu

class qgis.gui.QgsActionMenu

Bases: PyQt5.QtWidgets.QMenu

This class is a menu that is populated automatically with the actions defined for a given layer.

QgsActionMenu(layer: QgsVectorLayer, feature: QgsFeature, actionScope: str, parent: QWidget = None) Constructs a new QgsActionMenu

Parameters
  • layer – The layer that this action will be run upon.

  • feature – The feature that this action will be run upon. Make sure that this feature is available for the lifetime of this object.

  • parent – The usual QWidget parent.

  • actionScope – The action scope this menu will run in

QgsActionMenu(layer: QgsVectorLayer, fid: int, actionScope: str, parent: QWidget = None) Constructs a new QgsActionMenu

Parameters
class ActionData

Bases: sip.wrapper

Constructor for ActionData.

QgsActionMenu.ActionData(action: QgsAction, featureId: int, mapLayer: QgsMapLayer)

QgsActionMenu.ActionData(action: QgsMapLayerAction, featureId: int, mapLayer: QgsMapLayer)

QgsActionMenu.ActionData(QgsActionMenu.ActionData)

actionData
actionType
featureId
mapLayer
class ActionType

Bases: int

AttributeAction = 2
Invalid = 0
MapLayerAction = 1
actionEvent(self, QActionEvent)
changeEvent(self, QEvent)
childEvent(self, QChildEvent)
closeEvent(self, QCloseEvent)
columnCount(self) int
connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
create(self, window: sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
customEvent(self, QEvent)
destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, QMetaMethod)
dragEnterEvent(self, QDragEnterEvent)
dragLeaveEvent(self, QDragLeaveEvent)
dragMoveEvent(self, QDragMoveEvent)
dropEvent(self, QDropEvent)
enterEvent(self, QEvent)
event(self, QEvent) bool
expressionContextScope(self) QgsExpressionContextScope

Returns an expression context scope used to resolve underlying actions.

New in version 3.0.

Return type

QgsExpressionContextScope

focusInEvent(self, QFocusEvent)
focusNextChild(self) bool
focusNextPrevChild(self, bool) bool
focusOutEvent(self, QFocusEvent)
focusPreviousChild(self) bool
hideEvent(self, QHideEvent)
initPainter(self, QPainter)
initStyleOption(self, QStyleOptionMenuItem, QAction)
inputMethodEvent(self, QInputMethodEvent)
isSignalConnected(self, QMetaMethod) bool
keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
leaveEvent(self, QEvent)
menuActions(self) List[QgsAction]

Returns menu actions

New in version 3.12.

Return type

List[QgsAction]

metric(self, QPaintDevice.PaintDeviceMetric) int
mouseDoubleClickEvent(self, QMouseEvent)
mouseMoveEvent(self, QMouseEvent)
mousePressEvent(self, QMouseEvent)
mouseReleaseEvent(self, QMouseEvent)
moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], sip.voidptr) Tuple[bool, int]
paintEvent(self, QPaintEvent)
receivers(self, PYQT_SIGNAL) int
reinit

reinit(self) [signal]

resizeEvent(self, QResizeEvent)
sender(self) QObject
senderSignalIndex(self) int
setExpressionContextScope(self, scope: QgsExpressionContextScope)

Sets an expression context scope used to resolve underlying actions.

New in version 3.0.

Parameters

scope (QgsExpressionContextScope) –

setFeature(self, feature: QgsFeature)

Change the feature on which actions are performed

Parameters

feature (QgsFeature) – A feature. Will not take ownership. It’s the callers responsibility to keep the feature as long as the menu is displayed and the action is running.

setMode(self, mode: QgsAttributeEditorContext.Mode)

Change the mode of the actions

Parameters

mode (QgsAttributeEditorContext.Mode) – The mode of the attribute form

sharedPainter(self) QPainter
showEvent(self, QShowEvent)
tabletEvent(self, QTabletEvent)
timerEvent(self, QTimerEvent)
updateMicroFocus(self)
wheelEvent(self, QWheelEvent)