[QGIS-Developer] RES: Widget type

Jorge Almerio jorgealmerio at yahoo.com.br
Fri Jan 18 11:07:32 PST 2019


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:qgis-developer-bounces at lists.osgeo.org] Em nome de Tom Chadwin
Enviada em: sexta-feira, 18 de janeiro de 2019 13:20
Para: qgis-developer at lists.osgeo.org
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
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



More information about the QGIS-Developer mailing list