[Qgis-developer] QgsMapLayerAction and QgsAttributeAction

Nyall Dawson nyall.dawson at gmail.com
Tue Aug 12 04:33:59 PDT 2014


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

> As I am working on a menu, I am more interested in listing/triggering
> the action than creating a new one (like the one in your link).
>
> From this point (usage/triggering) there is not much difference as far
> as I can tell. So I think that it would be good to be able to query them
> in one particular place. Therefore I wondered, what you think about also
> exposing the attribute actions (custom) in the MapLayerActionRegistry?

Sounds good to me!

> I also have noticed, that the MapLayerActions are a subclass of the type
> QAction, but I don't think they can be used like that (I did not test,
> so please correct me if I am wrong. I just noticed that the trigger
> method is not connected, so if you add them to a menu there is not much
> happening I think). If this is true, I think it would not be nice to get
> a fully functional QAction similar to QgsAttributeTableMapLayerAction,
> that adds exactly this functionality around QgsMapLayerAction.

Hmm... it is a little strange, and I can't recall exactly why it
inherits from QAction.
I think it was something planned for the future but not implemented at
the time. Anyway,
I'm in favour of your proposal.

> Then there is only one small bit left - as far as I can tell - that is
> different between the two action types, which is that the custom actions
> support a type of "parameter" by substitution which allows to run them
> for a certain attribute or coordinate.
>
> Do you have any comments on these thoughts?

It all sounds good to me! I'm just happy to see MapLayerActions used
more extensively
and get a bit more publicity.

Let me know if you need any assistance with these changes.

Nyall


More information about the Qgis-developer mailing list