One of the attributes/features of my layer contains an email address. I'd like to be able to open the default mail client by clicking on the mail address from the Attribute Table.
After some initial investigation I've found, what seems to be, two different possibilities.
1) I could make an action 'Layer Properties/Actions', or
2) perhaps I could change the fields 'Edit widget' in Layer 'Properties/Fields' to a 'Web view', and that would take care of it(?)
On option 1) I'm a bit unsure how to create an action programmatically using PyQGIS.
I've found that a QgsVectorLayer
has a function actions()
that returns a QgsAttributeAction
object. The QgsAttributeAction
has an addAction
function, so I should be able to use it like this...
layer = iface.activeLayer()
aa = layer.actions()
aa.addAction(...)
but I'm not a 100% on the arguments. From the documentation:
addAction(QgsAction::ActionType type, QString name, QString action, bool capture=false)
Anyone done this before that could give a few hints?