By using "Identify Features" QGIS shows a form for viewing and editing attributes in the canvas.
Now I want to change the visible form elements dynamically by attribute value.
An example in pseudocode:
if attribute("status") = "closed": remove form element (attribute("status"))
In the layer properties there is the functionality of providing python code, but I have no clue how to access specific form elements. I thought it should be something like that (without conditional statement for testing), but without success:
from qgis.PyQt.QtWidgets import QWidget def my_form_open(dialog, layer, feature): status = dialog.findChild(QLabel,"status") removeChild(status)
Could someone give me a hint how to access the form elements (dialog.findChild?) and change their behavior?