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:
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
Methods
Returns an expression context scope used to resolve underlying actions.
Returns
True
if the menu has no valid actions.Returns menu actions
Sets an expression context scope used to resolve underlying actions.
Change the feature on which actions are performed
Change the mode of the actions
Signals
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
Attributes
- 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: PyQt5.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:
- 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)¶
- isEmpty(self) bool ¶
Returns
True
if the menu has no valid actions.New in version 3.30.
- Return type:
bool
- isSignalConnected(self, QMetaMethod) bool ¶
- keyPressEvent(self, QKeyEvent)¶
- keyReleaseEvent(self, QKeyEvent)¶
- leaveEvent(self, QEvent)¶
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], PyQt5.sip.voidptr) Tuple[bool, int] ¶
- paintEvent(self, QPaintEvent)¶
- receivers(self, PYQT_SIGNAL) int ¶
- reinit¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_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
- showEvent(self, QShowEvent)¶
- tabletEvent(self, QTabletEvent)¶
- timerEvent(self, QTimerEvent)¶
- updateMicroFocus(self)¶
- wheelEvent(self, QWheelEvent)¶