Class: QgsActionMenu

class qgis.gui.QgsActionMenu(layer: QgsVectorLayer, feature: QgsFeature, actionScope: str, parent: QWidget = None)

Bases: PyQt5.QtWidgets.QMenu

Constructs a new QgsActionMenu

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

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

  • parent (QWidget = None) – The usual QWidget parent.

  • actionScope (str) – The action scope this menu will run in

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

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

  • fid – The feature id of the feature for which this action will be run.

  • parent – The usual QWidget parent.

  • actionScope – The action scope this menu will run in

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

Methods

actionEvent

changeEvent

childEvent

closeEvent

columnCount

connectNotify

contextMenuEvent

create

customEvent

destroy

disconnectNotify

dragEnterEvent

dragLeaveEvent

dragMoveEvent

dropEvent

enterEvent

event

expressionContextScope

Returns an expression context scope used to resolve underlying actions.

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

hideEvent

initPainter

initStyleOption

inputMethodEvent

isSignalConnected

keyPressEvent

keyReleaseEvent

leaveEvent

menuActions

Returns menu actions

metric

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

mouseReleaseEvent

moveEvent

nativeEvent

paintEvent

receivers

resizeEvent

sender

senderSignalIndex

setExpressionContextScope

Sets an expression context scope used to resolve underlying actions.

setFeature

Change the feature on which actions are performed

setMode

Change the mode of the actions

sharedPainter

showEvent

tabletEvent

timerEvent

updateMicroFocus

wheelEvent

Signals

reinit

reinit(self) [signal]

Attributes

AttributeAction

Invalid

MapLayerAction

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()
changeEvent()
childEvent()
closeEvent()
columnCount()
connectNotify()
contextMenuEvent()
create()
customEvent()
destroy()
disconnectNotify()
dragEnterEvent()
dragLeaveEvent()
dragMoveEvent()
dropEvent()
enterEvent()
event()
expressionContextScope(self) → QgsExpressionContextScope

Returns an expression context scope used to resolve underlying actions.

New in version 3.0.

Return type

QgsExpressionContextScope

focusInEvent()
focusNextChild()
focusNextPrevChild()
focusOutEvent()
focusPreviousChild()
hideEvent()
initPainter()
initStyleOption()
inputMethodEvent()
isSignalConnected()
keyPressEvent()
keyReleaseEvent()
leaveEvent()
menuActions(self) → List[QgsAction]

Returns menu actions

New in version 3.12.

Return type

List[QgsAction]

metric()
mouseDoubleClickEvent()
mouseMoveEvent()
mousePressEvent()
mouseReleaseEvent()
moveEvent()
nativeEvent()
paintEvent()
receivers()
reinit

reinit(self) [signal]

resizeEvent()
sender()
senderSignalIndex()
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()
showEvent()
tabletEvent()
timerEvent()
updateMicroFocus()
wheelEvent()