[Qgis-developer] Python init script

Andreas Neumann a.neumann at carto.net
Thu Jul 10 02:29:44 PDT 2014


Hi Matthias,

I think the expression fields would definitely solve this problem.

Question:

Are the expression fields instead of the standard widget or in addition 
to the standard widgets? I would assume/hope the latter, as expression 
fields are not necessarily bound to a specific attribute but could be a 
combination of multiple attributes, geometry, logic, etc.

Andreas

Am 2014-07-10 10:39, schrieb Matthias Kuhn:
> Hi,
> 
> The dialog you get in the openForm method is a QgsAttributeForm.
> As such it is possible to access the method changeAttribute( fieldName, 
> value ).
> 
> However, this method - as well as the method you are currently using -
> do change the value of the field when you change something else and
> then save the form. And possibly even without changing something else.
> 
> Instead, I would use another approach if it's only for representation 
> issues:
> * Use field type hidden and somehow insert another read-only field
> which shows the value you want to show.
> * Wait for the PR with the expression fields to be merged
> * Implement a custom widget that is able to discern between a rounded
> representation and an internal more precise value
> 
> Best,
> Matthias



More information about the Qgis-developer mailing list