[QGIS-Developer] Refresh attribute form python action

matteo matteo.ghetta at gmail.com
Tue Jun 13 06:19:50 PDT 2023


Hi all,

I'm defining a python action that is triggered in the feature form (as a 
button or from the menu).

The action is retrieving some values from other layers and some of these 
values will update some form widget, avoiding the user to filling them 
manually (I really simplified the workflow :) ).

I think it is by design that QGIS is sending to the data provider the 
values when the OK button is clicked and then the Save button is 
clicked, but with the commitChanges() method I can directly send the 
changes to the provider from the action body.

Now the problem: the widgets are not updated unless the form is closed 
and reopened again. I couldn't find a method to refresh the form widget 
from the action itself. Is there any?

Cheers and thanks!

Matteo


More information about the QGIS-Developer mailing list