I am working on a PyQGIS script where I allow the user to add features using the addFeature() map tool, where the user can create the geometry of the feature by clicking on the canvas, and after the geometry has been created, the user will be prompt up with a table where he can enter the attributes of the feature.
The question is, some attributes of the feature should be pre-defined, and some can be entered by the user. I found out that by using the following code I can suppress the prompt.
layer.editFormConfig().setSuppress(QgsEditFormConfig.SuppressOff)
But I still want the user to be able to enter most of the attributes after the new feature has been added, so it is not a good solution.
Is there another way where I can define some attributes after the feature has been added, and then prompt the table? In that way, the pre-defined value should be shown in the table when it is opened, so the user does not have to give value to them again.