[QGIS-Developer] pyqgis: editFormConfig.widgetConfig
Matthias Kuhn
matthias at opengis.ch
Fri Jul 26 04:02:23 PDT 2019
Hi Jörg,
The easiest way is to set it up manually and inspect what the API returns.
>>> iface.activeLayer().editorWidgetSetup(1).type()
'ValueRelation'
>>> iface.activeLayer().editorWidgetSetup(1).config()
{'AllowMulti': False, 'AllowNull': False, 'FilterExpression': '', 'Key':
'fid', 'Layer': 'countries_9ed4f4a4_f300_4bd3_a496_4b5fab68fc01',
'LayerName': 'countries', 'LayerProviderName': 'ogr', 'LayerSource':
'countries.gpkg', 'NofColumns': 1, 'OrderByValue': False,
'UseCompleter': False, 'Value': 'test'}
>>> iface.activeLayer().setEditorWidgetSetup(1,
QgsEditorWidgetSetup('TextEdit', {} ))
Hope that helps
BR
Matthias
On 7/26/19 10:45 AM, Prof. Dr. Jörg Höttges wrote:
>
> Hi all,
>
> in a QGIS3 plugin I need to modify the editwidget from "TextEdit" to
> e. g. "ValueRelation". How can I find out the Widgetname that I need
> for editFormConfig.widgetConfig(widgetname)? Or is this the wrong way
> to do it?
>
> Thanks in advance
>
> Jörg
>
>
> FH Aachen
> Prof. Dr.-Ing. Jörg Höttges
> Fachbereich 2 - Bauingenieurwesen
> Wasserwirtschaft und Bauinformatik
> Raum 02315
> FH Aachen
> University of Applied Sciences
> Bayernallee 9
> 52066 Aachen | Germany
> T +49 (0)241 6009-51176
> F +49 (0)241 6009-51206
> http://www.fh-aachen.de/hoettges/
> hoettges at fh-aachen.de <mailto:hoettges at fh-aachen.de>
>
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190726/94ebc08c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bkmnljcbcicebpce.png
Type: image/png
Size: 839 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190726/94ebc08c/attachment.png>
More information about the QGIS-Developer
mailing list