[QGIS-Developer] Widget type

Jorge Almerio jorgealmerio at yahoo.com.br
Fri Jan 18 07:09:23 PST 2019

Hi devs,


How can I create or change a Field with the Widget type to "Text Edit"?


I had tried with code below:


pipeLyr = iface.activeLayer()

campo = "DNteste"

DNfld = QgsField(campo, QVariant.Int)




#pipeLyr.setEditorWidgetSetup(field_index,'Text Edit')

pipeLyr.editFormConfig().setWidgetConfig(field_index, 'EditText')


But I got:


QgsEditFormConfig.setWidgetConfig(): argument 1 has unexpected type 'int'


Thanks in advance,


Jorge Almerio

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190118/81925f76/attachment-0001.html>

More information about the QGIS-Developer mailing list