6

I want a custom "QGIS 2.14.6 Essen" layer edit form in my own python plugin.

I use layer.setEditForm( NODE_ui_path ) and layer.setEditFormInit('NODE.formOpen')

Function NODE.formOpen does not work!

MyPlugin is in ~\.qgis2\python\plugins\MyPlugin

Ui Form is in ~\.qgis2\python\plugins\MyPlugin\NODE.ui

formOpen is in ~\.qgis2\python\plugins\MyPlugin\NODE.py

2 Answers 2

3

Solved by :

layer.editFormConfig().setInitCodeSource(1)
layer.editFormConfig().setInitFilePath(python_file_path)
layer.setEditForm(ui_file_path)
layer.setEditFormInit('formOpen')

Thanks !

3

IN QGIS 3.0

config = layer.editFormConfig()
config.setInitCodeSource(1)
config.setUiForm("ui_file.ui")
config.setInitFilePath("py_file.py")
config.setInitFunction("method_name")
layer.setEditFormConfig(config)

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .