[Qgis-developer] Support for field aliases in expressions

Martin Dobias wonder.sk at gmail.com
Wed Sep 24 12:28:30 PDT 2014


Hi Matthias

On Thu, Sep 11, 2014 at 2:28 PM, Matthias Kuhn <matthias.kuhn at gmx.ch> wrote:
>>>
>>     I am just wondering... how the aliases would be made accessible to
>>     QgsExpression? Would be a map of aliases from vector layer set to each
>>     QgsExpression instace? Or extend QgsFields to support also aliases? Or
>>     something completely different? :-)
>
>
> I did not put any thoughts into the implementation yet. But I was thinking
> about the second idea (saving aliases in QgsField) before. I think it would
> be better suited there than keeping it separately. Are you sceptical
> concerning this approach?

I would probably also go with the latter as I don't really like the
former. But I haven't thought much about the implications anyway...

On a related note - I am not sure how consistently do we use aliases
versus "raw" field names within the GUI. Once an alias is defined,
shouldn't the user always see just the alias instead of the real field
name? And what about internal representation - shall we always store
raw field name when storing reference to a field? (in memory or in a
file)

This leads me to a thought that in theory an expression could always
contain just raw field names, but when the expression is shown/edited
in GUI, the user would see the alias instead... (just an idea)

Cheers
Martin


More information about the Qgis-developer mailing list