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

Builds a menu to be used with identify results. More...

#include <qgsidentifymenu.h>

Inheritance diagram for QgsIdentifyMenu:

Classes

struct  ActionData

Public Types

enum  MenuLevel { LayerLevel , FeatureLevel }

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.

Public Member Functions

 QgsIdentifyMenu (QgsMapCanvas *canvas)
 QgsIdentifyMenu is a menu to be used to choose within a list of QgsMapTool::IdentifyReults.
 ~QgsIdentifyMenu () override
void addCustomAction (QgsMapLayerAction *action)
 adds a new custom action to the menu
bool allowMultipleReturn ()
QList< QgsMapToolIdentify::IdentifyResultexec (const QList< QgsMapToolIdentify::IdentifyResult > &idResults, QPoint pos)
 exec
bool execWithSingleResult ()
QgsExpressionContextScope expressionContextScope () const
 Returns an expression context scope used to resolve underlying actions.
int maxFeatureDisplay ()
int maxLayerDisplay ()
void removeCustomActions ()
 remove all custom actions from the menu to be built
bool resultsIfExternalAction ()
void setAllowMultipleReturn (bool multipleReturn)
 define if the menu executed can return multiple results (e.g. all results or all identified features of a vector layer)
void setExecWithSingleResult (bool execWithSingleResult)
 define if the menu will be shown with a single identify result
void setExpressionContextScope (const QgsExpressionContextScope &scope)
 Sets an expression context scope used to resolve underlying actions.
void setMaxFeatureDisplay (int maxFeatureDisplay)
 Defines the maximum number of features displayed in the menu for vector layers (default is 10).
void setMaxLayerDisplay (int maxLayerDisplay)
 Defines the maximum number of layers displayed in the menu (default is 10).
void setResultsIfExternalAction (bool resultsIfExternalAction)
 setResultsIfExternalAction if set to false (default) the menu will not return any results if an external action has been triggered
void setShowFeatureActions (bool showFeatureActions)
 define if attribute actions(1) and map layer actions(2) can be listed and run from the menu
bool showFeatureActions ()

Static Public Member Functions

static QList< QgsMapToolIdentify::IdentifyResultfindFeaturesOnCanvas (QgsMapMouseEvent *event, QgsMapCanvas *canvas, const QList< Qgis::GeometryType > &geometryTypes)
 Searches for features on the map canvas, which are located at the specified event point.
static Q_DECL_DEPRECATED void styleHighlight (QgsHighlight *highlight)
 Applies style from the settings to the highlight.

Protected Member Functions

void closeEvent (QCloseEvent *e) override

Detailed Description

Builds a menu to be used with identify results.

It is customizable and can display attribute actions (

See also
QgsAction) as well as map layer actions (
QgsMapLayerAction). It can also embed custom map layer actions, defined for this menu exclusively. If used in a QgsMapToolIdentify, it is accessible via QgsMapToolIdentify::identifyMenu() and can be customized in the map tool sub-class.
QgsMapToolIdentify

Definition at line 52 of file qgsidentifymenu.h.

Member Enumeration Documentation

◆ MenuLevel

Enumerator
LayerLevel 
FeatureLevel 

Definition at line 57 of file qgsidentifymenu.h.

Constructor & Destructor Documentation

◆ QgsIdentifyMenu()

QgsIdentifyMenu::QgsIdentifyMenu ( QgsMapCanvas * canvas)
explicit

QgsIdentifyMenu is a menu to be used to choose within a list of QgsMapTool::IdentifyReults.

Definition at line 36 of file qgsidentifymenu.cpp.

◆ ~QgsIdentifyMenu()

QgsIdentifyMenu::~QgsIdentifyMenu ( )
override

Definition at line 43 of file qgsidentifymenu.cpp.

Member Function Documentation

◆ addCustomAction()

void QgsIdentifyMenu::addCustomAction ( QgsMapLayerAction * action)
inline

adds a new custom action to the menu

Definition at line 164 of file qgsidentifymenu.h.

◆ allowMultipleReturn()

bool QgsIdentifyMenu::allowMultipleReturn ( )
inline

Definition at line 115 of file qgsidentifymenu.h.

◆ closeEvent()

void QgsIdentifyMenu::closeEvent ( QCloseEvent * e)
overrideprotected

Definition at line 227 of file qgsidentifymenu.cpp.

◆ exec()

QList< QgsMapToolIdentify::IdentifyResult > QgsIdentifyMenu::exec ( const QList< QgsMapToolIdentify::IdentifyResult > & idResults,
QPoint pos )

exec

Parameters
idResultsthe list of identify results to choose within
posthe position where the menu will be executed

Definition at line 124 of file qgsidentifymenu.cpp.

◆ execWithSingleResult()

bool QgsIdentifyMenu::execWithSingleResult ( )
inline

Definition at line 119 of file qgsidentifymenu.h.

◆ expressionContextScope()

QgsExpressionContextScope QgsIdentifyMenu::expressionContextScope ( ) const

Returns an expression context scope used to resolve underlying actions.

Definition at line 742 of file qgsidentifymenu.cpp.

◆ findFeaturesOnCanvas()

QList< QgsMapToolIdentify::IdentifyResult > QgsIdentifyMenu::findFeaturesOnCanvas ( QgsMapMouseEvent * event,
QgsMapCanvas * canvas,
const QList< Qgis::GeometryType > & geometryTypes )
static

Searches for features on the map canvas, which are located at the specified event point.

The geometryTypes argument lists acceptable geometry types.

This method searches through all layers on the canvas, attempting to find matching features at the event point.

Since
QGIS 3.26

Definition at line 48 of file qgsidentifymenu.cpp.

◆ maxFeatureDisplay()

int QgsIdentifyMenu::maxFeatureDisplay ( )
inline

Definition at line 161 of file qgsidentifymenu.h.

◆ maxLayerDisplay()

int QgsIdentifyMenu::maxLayerDisplay ( )
inline

Definition at line 154 of file qgsidentifymenu.h.

◆ messageDiscarded

void QgsIdentifyMenu::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 QgsIdentifyMenu::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

◆ removeCustomActions()

void QgsIdentifyMenu::removeCustomActions ( )

remove all custom actions from the menu to be built

Definition at line 732 of file qgsidentifymenu.cpp.

◆ resultsIfExternalAction()

bool QgsIdentifyMenu::resultsIfExternalAction ( )
inline

Definition at line 147 of file qgsidentifymenu.h.

◆ setAllowMultipleReturn()

void QgsIdentifyMenu::setAllowMultipleReturn ( bool multipleReturn)
inline

define if the menu executed can return multiple results (e.g. all results or all identified features of a vector layer)

Definition at line 114 of file qgsidentifymenu.h.

◆ setExecWithSingleResult()

void QgsIdentifyMenu::setExecWithSingleResult ( bool execWithSingleResult)
inline

define if the menu will be shown with a single identify result

Definition at line 118 of file qgsidentifymenu.h.

◆ setExpressionContextScope()

void QgsIdentifyMenu::setExpressionContextScope ( const QgsExpressionContextScope & scope)

Sets an expression context scope used to resolve underlying actions.

Definition at line 737 of file qgsidentifymenu.cpp.

◆ setMaxFeatureDisplay()

void QgsIdentifyMenu::setMaxFeatureDisplay ( int maxFeatureDisplay)

Defines the maximum number of features displayed in the menu for vector layers (default is 10).

Note
0 is unlimited.

Definition at line 114 of file qgsidentifymenu.cpp.

◆ setMaxLayerDisplay()

void QgsIdentifyMenu::setMaxLayerDisplay ( int maxLayerDisplay)

Defines the maximum number of layers displayed in the menu (default is 10).

Note
0 is unlimited.

Definition at line 104 of file qgsidentifymenu.cpp.

◆ setResultsIfExternalAction()

void QgsIdentifyMenu::setResultsIfExternalAction ( bool resultsIfExternalAction)
inline

setResultsIfExternalAction if set to false (default) the menu will not return any results if an external action has been triggered

Note
external action can be either custom actions or feature / map layer actions (
See also
setShowFeatureActions)

Definition at line 146 of file qgsidentifymenu.h.

◆ setShowFeatureActions()

void QgsIdentifyMenu::setShowFeatureActions ( bool showFeatureActions)
inline

define if attribute actions(1) and map layer actions(2) can be listed and run from the menu

Note
custom actions will be shown in any case if they exist.
(1) attribute actions are defined by the user in the layer properties
See also
QgsAction
Note
(2) map layer actions are built-in c++ actions or actions which are defined by a Python plugin
See also
QgsMapLayerActionRegistry

Definition at line 139 of file qgsidentifymenu.h.

◆ showFeatureActions()

bool QgsIdentifyMenu::showFeatureActions ( )
inline

Definition at line 140 of file qgsidentifymenu.h.

◆ styleHighlight()

void QgsIdentifyMenu::styleHighlight ( QgsHighlight * highlight)
static

Applies style from the settings to the highlight.

Deprecated
QGIS 3.40. Use QgsHighlight::applyDefaultStyle() instead.

Definition at line 702 of file qgsidentifymenu.cpp.


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