[Qgis-developer] QgsMapLayerAction and QgsAttributeAction

Nyall Dawson nyall.dawson at gmail.com
Mon Aug 11 21:34:45 PDT 2014


On 12 August 2014 01:25, Matthias Kuhn <matthias.kuhn at gmx.ch> wrote:

> While working on this, I stumbled upon the class QgsMapLayerAction which
> I am having a hard time to understand the purpose of.
>
> Some comments in qgsdualview.cpp suggest that it is related to user
> defined actions vs standard actions [1]. I wondered also if it is
> related to vector layer vs raster layer (as QgsMapLayer is a common base
> class of the two and QgsMapLayerAction therefore might be interpreted as
> "also valid for raster layers").

I can help you out here - QgsMapLayerActions are built-in c++ actions,
or actions which are defined by a python plugin. Unlike the standard
vector layer actions, these are not editable by users, and are not
listed in the vector layer properties dialog. As far as I'm aware,
there's only a single implementation currently in QGIS:
https://github.com/qgis/QGIS/blob/master/src/app/composer/qgscomposer.cpp#L3566
This action allows users to jump directly to a specific atlas feature,
and is only shown for vector layers which are set as the coverage
layer for a composition.

There's also some useful sample python code on how these actions can
be used here:
http://gis.stackexchange.com/a/94665/28443

Nyall


More information about the Qgis-developer mailing list