Class: QgsIdentifyMenu

class qgis.gui.QgsIdentifyMenu(canvas: QgsMapCanvas)

Bases: PyQt5.QtWidgets.QMenu

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

The QgsIdentifyMenu class builds a menu to be used with identify results (QgsMapToolIdentify). It is customizable and can display attribute actions (QgsAction) as well as map layer actions (see 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.

Enums

Methods

actionEvent

addCustomAction

adds a new custom action to the menu

allowMultipleReturn

changeEvent

childEvent

closeEvent

columnCount

connectNotify

contextMenuEvent

create

customEvent

destroy

disconnectNotify

dragEnterEvent

dragLeaveEvent

dragMoveEvent

dropEvent

enterEvent

event

exec

exec

execWithSingleResult

expressionContextScope

Returns an expression context scope used to resolve underlying actions.

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

hideEvent

initPainter

initStyleOption

inputMethodEvent

isSignalConnected

keyPressEvent

keyReleaseEvent

leaveEvent

maxFeatureDisplay

maxLayerDisplay

metric

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

mouseReleaseEvent

moveEvent

nativeEvent

paintEvent

receivers

removeCustomActions

remove all custom actions from the menu to be built

resizeEvent

resultsIfExternalAction

sender

senderSignalIndex

setAllowMultipleReturn

define if the menu executed can return multiple results (e.g.

setExecWithSingleResult

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

setExpressionContextScope

Sets an expression context scope used to resolve underlying actions.

setMaxFeatureDisplay

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

setMaxLayerDisplay

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

setResultsIfExternalAction

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

setShowFeatureActions

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

sharedPainter

showEvent

showFeatureActions

tabletEvent

timerEvent

updateMicroFocus

wheelEvent

Signals

Attributes

FeatureLevel

LayerLevel

class ActionData

Bases: sip.wrapper

Constructor for ActionData

QgsIdentifyMenu.ActionData(layer: QgsMapLayer, mapLayerAction: QgsMapLayerAction = None)

QgsIdentifyMenu.ActionData(layer: QgsMapLayer, fid: int, mapLayerAction: QgsMapLayerAction = None)

QgsIdentifyMenu.ActionData(QgsIdentifyMenu.ActionData)

mAllResults
mFeatureId
mIsExternalAction
mIsValid
mLayer
mLevel
mMapLayerAction
FeatureLevel = 1
LayerLevel = 0
class MenuLevel

Bases: int

actionEvent()
addCustomAction(self, action: QgsMapLayerAction)

adds a new custom action to the menu

allowMultipleReturn(self) → bool
changeEvent()
childEvent()
closeEvent(self, e: QCloseEvent)
columnCount()
connectNotify()
contextMenuEvent()
create()
customEvent()
destroy()
disconnectNotify()
dragEnterEvent()
dragLeaveEvent()
dragMoveEvent()
dropEvent()
enterEvent()
event()
exec(self, idResults: Iterable[QgsMapToolIdentify.IdentifyResult], pos: QPoint) → object

exec

Parameters
  • idResults – the list of identify results to choose within

  • pos – the position where the menu will be executed

execWithSingleResult(self) → bool
expressionContextScope(self) → QgsExpressionContextScope

Returns an expression context scope used to resolve underlying actions.

New in version 3.0.

focusInEvent()
focusNextChild()
focusNextPrevChild()
focusOutEvent()
focusPreviousChild()
hideEvent()
initPainter()
initStyleOption()
inputMethodEvent()
isSignalConnected()
keyPressEvent()
keyReleaseEvent()
leaveEvent()
maxFeatureDisplay(self) → int
maxLayerDisplay(self) → int
metric()
mouseDoubleClickEvent()
mouseMoveEvent()
mousePressEvent()
mouseReleaseEvent()
moveEvent()
nativeEvent()
paintEvent()
receivers()
removeCustomActions(self)

remove all custom actions from the menu to be built

resizeEvent()
resultsIfExternalAction(self) → bool
sender()
senderSignalIndex()
setAllowMultipleReturn(self, multipleReturn: bool)

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

setExecWithSingleResult(self, execWithSingleResult: bool)

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

setExpressionContextScope(self, scope: QgsExpressionContextScope)

Sets an expression context scope used to resolve underlying actions.

New in version 3.0.

setMaxFeatureDisplay(self, maxFeatureDisplay: int)

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

Note

0 is unlimited.

setMaxLayerDisplay(self, maxLayerDisplay: int)

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

Note

0 is unlimited.

setResultsIfExternalAction(self, resultsIfExternalAction: bool)

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 (setShowFeatureActions())

setShowFeatureActions(self, showFeatureActions: bool)

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.

Note

  1. attribute actions are defined by the user in the layer properties QgsAction

Note

  1. map layer actions are built-in c++ actions or actions which are defined by a Python plugin QgsMapLayerActionRegistry

sharedPainter()
showEvent()
showFeatureActions(self) → bool
tabletEvent()
timerEvent()
updateMicroFocus()
wheelEvent()