How can I add new actions to identify feature context menu? I mean when selecting a feature with identify tool and right click on the selected feature, here I want to add new actions to the popup menu.

this picture is showing the required

  • 2
    What type of new actions are you looking to add?
    – whyzar
    Oct 16, 2017 at 16:56
  • I think that you can't add new actions to this context menu because it is created on the fly.
    – Fran Raga
    Oct 18, 2017 at 7:07
  • @whyzar i want to some new menu items to do some calculations on the selected feature.
    – abd0991
    Oct 18, 2017 at 8:28
  • @FranciscoRaga have any link confirms your thoughts? thx.
    – abd0991
    Oct 18, 2017 at 8:31
  • 1
    Update link and delete before comment. github.com/qgis/QGIS/blob/master/src/gui/…
    – Fran Raga
    Oct 18, 2017 at 11:44

2 Answers 2


You can do that accessing the QgsMapToolIdentify.identifyMenu() and adding a custom action to it.

enter image description here

To test it, just run once the following code snippet in the QGIS Python Console. Then activate the identify map tool and... voilà !

b_action_added = False  # To avoid duplicating the action

def action_slot(layer, feature):
    """What our new action will do?"""
                            "Feature's WKT ({}:{})".format(layer.name(), feature.id()),

def add_action(tool, old_tool):
    """Add the new action to the identify menu"""
    global b_action_added
    if not b_action_added and isinstance(tool, QgsMapToolIdentify):
        b_action_added = True
        menu = tool.identifyMenu()
        my_action = QgsMapLayerAction("Show feature's WKT", 


Note that you can achieve the same result by creating a layer action with feature scope:

enter image description here

enter image description here


As far as I'm aware, there is no feature in QGIS that provide you with the ability to customize the view feature form as shown in your image below, when you identify a feature. The only features that allow for customization is to follow up with selecting a auto open form, which will provide a dialogue box that could be edit if needed or view able in conjunction with the identify console box.

enter image description here

You may want to look in QT designer in creating a custom form that may be helpful in finding a solution.

QGIS Tips – Custom feature forms with Python logic

enter image description here

  • Thanks for mentioning this feature. 1+ becuase i don't know this feature.
    – abd0991
    Oct 18, 2017 at 8:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.