You are right, but how to use "setEditorWidgetSetup" method? From doc reference: QgsVectorLayer::setEditorWidgetSetup (int index, const QgsEditorWidgetSetup & setup)
The first argument is the field index, ok, it's easy. But second is a QgsEditorWidgetSetup, I don't know how to create one. My code: pipeLyr = iface.activeLayer() field_index = 3 #here just for test pipeLyr.setEditorWidgetSetup(field_index,'EditText') I got: TypeError: QgsVectorLayer.setEditorWidgetSetup(): argument 2 has unexpected type 'str' -----Mensagem original----- De: QGIS-Developer [mailto:[email protected]] Em nome de Tom Chadwin Enviada em: sexta-feira, 18 de janeiro de 2019 13:20 Para: [email protected] Assunto: Re: [QGIS-Developer] Widget type Ignore previous completely wrong answer! Sorry. I think you call QgsVectorLayer::setEditorWidgetSetup() instead: https://qgis.org/api/classQgsVectorLayer.html#a8a174ba67d0a16f544211088656af143 Tom ----- Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon -- Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html _______________________________________________ QGIS-Developer mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer _______________________________________________ QGIS-Developer mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
