We are developing a QGIS plugin and would like to override the QGIS Feature Edit Form with our own Dialog.

Have explored using setEditForm and setEditFormInit, but the init process appears to want to use a python file located in the user's project directory.

Ideally we'd use an init method from our Plugin's code and gain access to our Plugin's instance.

Had thought that the new EditWidget V2 might be able to help, but this seems to be focussed on editing individual attributes rather than a feature.


Doh. Managed to resolve it.

In the init method of your plugin:

Firstly add the plugin directory to the system path list (or a subdirectory of it) Secondly, initialise a static variable with the Plugin's instance (self)

Am yet to add logic to the dialog but looks like we're on the home run. Thanks Python!

  • Note: the signature of FormInit appears to have changed from that documented - the layer is passed as arg 2, not the layered.
    – NZ Farmer
    Sep 13, 2014 at 8:42
  • Remember to post your solution as an answer :)
    – Joseph
    Sep 15, 2014 at 10:09


Your Answer

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

Browse other questions tagged or ask your own question.