[Qgis-developer] how to use value relation edittype with python

josef k groundwatergis at gmail.com
Wed Aug 10 12:28:26 PDT 2016


Hello,

I am trying to setup a value relation edittype by pyqgis. I can use
setWidgetType but then, none of the following seem to work:

vlayer.valueRelation(index).mLayer = target_layer.id()
vlayer.valueRelation(index).mKey = key_field
vlayer.valueRelation(index).mValue = value_field
vlayer.valueRelation(index).mAllowNull = True
vlayer.valueRelation(index).mOrderByValue

I also asked this question at GIS stackexchange (
http://gis.stackexchange.com/questions/204175/how-to-set-and-configure-a-value-relation-edittype-in-qgis-2-14)
but no responses so far.

Does anyone know how to configure the value relation from python?

Thanks,
Josef
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160810/fef20cb1/attachment.html>


More information about the Qgis-developer mailing list