I am using QGIS 3.32 to set the field alias:

layer = iface.activeLayer()
layer.setFieldAlias(0, 'this is field')

I want the field aliases to show in the feature form only, not in the attribute table. How to acheive this using PyQGIS?

1 Answer 1


There are 3 ways to create feature form:

  1. automaticaly generated form
  2. user defined "drag'n'drop" form
  3. user defined *.ui form

With 1st and 2nd methods, the field headers in the table and form are the same

With the 3rd method you can set field title manually or with code

Relevant for older versions of QGIS. Maybe there are some new options in 3.32.

  • From drag and drop, I wanted to add html widget/ Text widget using pyqgis. Is it possible
    – BenStone
    Aug 8, 2023 at 6:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.