[Qgis-developer] Set QgsVectorLayer.EditType to value map and populate value:description pairs with python

Eric Goddard egoddard1010 at gmail.com
Mon Jan 27 11:21:35 PST 2014

Hi all,

I'm running QGIS Master. I would like to update a vector layer's EditType
to a ValueMap and pass in the value:description pairs using python. I
haven't ever used C++ and am having some difficulty understanding the
documentation. Through reading the documentation and trial and error I was
able to adjust the edit type to a Value map with:

vectLayer = iface.ActiveLayer()
vectLayer.setEditType(4, QgsVectorLayer.EditType(3))

where 4 is the id of the attribute I want to update and
QgsVectorLayer.EditType(3) sets the EditType to a Value Map.

And this is where I'm stuck. I can't find anything in the API docs about
how to set the value-description pairs. Any help would be greatly

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20140127/027eb7af/attachment.html>

More information about the Qgis-developer mailing list