[Qgis-developer] Expression context and custom functions

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Fri Sep 4 02:57:28 PDT 2015


Maybe I've misunderstood, but are you trying to define a new function
to appear as an expression? Isn't that what the @qgsfunction decorator
does? Do you need to define a new class for this?

http://nathanw.net/2015/01/19/function-editor-for-qgis-expressions/

On Thu, Sep 3, 2015 at 4:12 PM, Hugo Mercier <hugo.mercier at oslandia.com> wrote:
> Hi,
>
> I am using custom expressions functions for a plugin.
> Something like this :
>
> class MyFunction( QgsExpression.Function ):
>     def func( self, values, feature, parent ):
>         feature.geometry()
>         ...
>
> The problem is that "feature" is now a QgsExpressionContext(), not a
> QgsFeature anymore.
> I cannot find how to access the feature from the context. Did I miss
> something ?
>
> Thanks
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the Qgis-developer mailing list