QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
QgsActionMenu Class Reference

A menu that is populated automatically with the actions defined for a given layer. More...

#include <qgsactionmenu.h>

Inheritance diagram for QgsActionMenu:

Classes

struct  ActionData

Signals

void messageDiscarded ()
 Emitted when the previous message from the tool should be cleared from the application message bar.
void messageEmitted (const QString &message, Qgis::MessageLevel level=Qgis::MessageLevel::Info)
 Emitted when a message should be shown to the user in the application message bar.
void reinit ()
 Emitted after actions have been reloaded.

Public Member Functions

 QgsActionMenu (QgsVectorLayer *layer, const QgsFeature &feature, const QString &actionScope, QWidget *parent=nullptr)
 Constructs a new QgsActionMenu.
 QgsActionMenu (QgsVectorLayer *layer, QgsFeatureId fid, const QString &actionScope, QWidget *parent=nullptr)
 Constructs a new QgsActionMenu.
QgsExpressionContextScope expressionContextScope () const
 Returns an expression context scope used to resolve underlying actions.
bool isEmpty () const
 Returns true if the menu has no valid actions.
QList< QgsActionmenuActions () const
 Returns menu actions.
void setActionContextGenerator (QgsMapLayerActionContextGenerator *generator)
 Sets a QgsMapLayerActionContextGenerator to create action contexts for the menu.
void setExpressionContextScope (const QgsExpressionContextScope &scope)
 Sets an expression context scope used to resolve underlying actions.
void setFeature (const QgsFeature &feature)
 Change the feature on which actions are performed.
void setMode (QgsAttributeEditorContext::Mode mode)
 Change the mode of the actions.

Detailed Description

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

Definition at line 37 of file qgsactionmenu.h.

Constructor & Destructor Documentation

◆ QgsActionMenu() [1/2]

QgsActionMenu::QgsActionMenu ( QgsVectorLayer * layer,
const QgsFeature & feature,
const QString & actionScope,
QWidget * parent = nullptr )
explicit

Constructs a new QgsActionMenu.

Parameters
layerThe layer that this action will be run upon.
featureThe feature that this action will be run upon. Make sure that this feature is available for the lifetime of this object.
parentThe usual QWidget parent.
actionScopeThe action scope this menu will run in

Definition at line 28 of file qgsactionmenu.cpp.

◆ QgsActionMenu() [2/2]

QgsActionMenu::QgsActionMenu ( QgsVectorLayer * layer,
QgsFeatureId fid,
const QString & actionScope,
QWidget * parent = nullptr )
explicit

Constructs a new QgsActionMenu.

Parameters
layerThe layer that this action will be run upon.
fidThe feature id of the feature for which this action will be run.
parentThe usual QWidget parent.
actionScopeThe action scope this menu will run in

Definition at line 38 of file qgsactionmenu.cpp.

Member Function Documentation

◆ expressionContextScope()

QgsExpressionContextScope QgsActionMenu::expressionContextScope ( ) const

Returns an expression context scope used to resolve underlying actions.

Definition at line 255 of file qgsactionmenu.cpp.

◆ isEmpty()

bool QgsActionMenu::isEmpty ( ) const

Returns true if the menu has no valid actions.

Since
QGIS 3.30

Definition at line 265 of file qgsactionmenu.cpp.

◆ menuActions()

QList< QgsAction > QgsActionMenu::menuActions ( ) const

Returns menu actions.

Since
QGIS 3.12

Definition at line 260 of file qgsactionmenu.cpp.

◆ messageDiscarded

void QgsActionMenu::messageDiscarded ( )
signal

Emitted when the previous message from the tool should be cleared from the application message bar.

See also
messageEmitted()
Since
QGIS 4.0

◆ messageEmitted

void QgsActionMenu::messageEmitted ( const QString & message,
Qgis::MessageLevel level = Qgis::MessageLevel::Info )
signal

Emitted when a message should be shown to the user in the application message bar.

See also
messageDiscarded()
Since
QGIS 4.0

◆ reinit

void QgsActionMenu::reinit ( )
signal

Emitted after actions have been reloaded.

◆ setActionContextGenerator()

void QgsActionMenu::setActionContextGenerator ( QgsMapLayerActionContextGenerator * generator)

Sets a QgsMapLayerActionContextGenerator to create action contexts for the menu.

The generator object must exist for the lifetime of the menu.

Since
QGIS 3.30

Definition at line 47 of file qgsactionmenu.cpp.

◆ setExpressionContextScope()

void QgsActionMenu::setExpressionContextScope ( const QgsExpressionContextScope & scope)

Sets an expression context scope used to resolve underlying actions.

Definition at line 249 of file qgsactionmenu.cpp.

◆ setFeature()

void QgsActionMenu::setFeature ( const QgsFeature & feature)

Change the feature on which actions are performed.

Parameters
featureA 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.

Definition at line 76 of file qgsactionmenu.cpp.

◆ setMode()

void QgsActionMenu::setMode ( QgsAttributeEditorContext::Mode mode)

Change the mode of the actions.

Parameters
modeThe mode of the attribute form

Definition at line 81 of file qgsactionmenu.cpp.


The documentation for this class was generated from the following files: