[Qgis-developer] Questions about QgsEditorWidgetWrapper value() / setValue()

Even Rouault even.rouault at spatialys.com
Fri Apr 22 05:38:43 PDT 2016


Hi,

I'm trying to understand the abstraction of QgsEditorWidgetWrapper.

1) Semantics question
Am I right that there's no guarantee (and that's actually intended) that the 
following pseudo-code is true :
	setValue(v)
	assert value() == v 

For example in the QgsValueRelationWidgetWrapper(), value() returns the value 
of the value column of the referenced layer, which corresponds to the key 
provided to setValue().
And that's value() that is used when displaying the attribute table in table 
view mode.
So this value() method is more a displayValue(), right ? And setValue() would 
be setRawValue() / setSourceValue() ?

2) Implementation of QgsRelationReferenceWidgetWrapper.
The value() method in that case actually returns the foreign key set by 
setValue(). Is that intended ? To have similar behaviour as 
QgsValueRelationWidgetWrapper, one could rather expect value() to return the 
evaluation of the display expression, no ?
If the current behaviour is intended, is there something in the abstraction of 
QgsEditorWidgetWrapper that could return the evaluation of the display 
expression for a QgsRelationReferenceWidgetWrapper ?

Thanks

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the Qgis-developer mailing list