I would like to hide a field column while editing. The following code works perfectly in pyqgis2.
def fieldVisibility (layer,fname): f = layer.editFormConfig() for i, column in enumerate(layer.fields()): if column.name()==fname: f.setWidgetType(i, "Hidden") break else: continue
setWidgetType has been superseded and I don’t know the new expression in pyqgis3.
setWidgetType()now only take a string as the first parameter. Access by index has been removed. (source)[qgis.org/api/api_break.html]