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.addAttribute(DNfld)

pipeLyr.updateFields()

field_index=pipeLyr.fields().indexFromName(campo)

#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

_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to