Add documentation for @qgsfunction

This commit is contained in:
Matthias Kuhn 2018-07-01 06:31:26 -05:00
parent 4d5eb49f1c
commit 45fdd0fb31

View File

@ -50,8 +50,8 @@ def register_function(function, arg_count, group, usesgeometry=False,
:param function: :param function:
:param arg_count: :param arg_count:
:param group: :param group:
:param usesgeometry: :param usesgeometry:
:param handlesnull: :param handlesnull: Needs to be set to True if this function has does not always return NULL if any parameter is NULL. Default False.
:return: :return:
""" """
@ -137,6 +137,19 @@ def qgsfunction(args='auto', group='custom', **kwargs):
""" """
Decorator function used to define a user expression function. Decorator function used to define a user expression function.
:param args: Number of parameters, set to 'auto' to accept a variable length of parameters.
:param group: The expression group to which this expression should be added.
:param \**kwargs:
See below
:Keyword Arguments:
* *referenced_columns* (``list``) --
An array of field names on which this expression works. Can be set to ``[QgsFeatureRequest.ALL_ATTRIBUTES]``. By default empty.
* *usesgeometry* (``bool``) --
Defines if this expression requires the geometry. By default False.
* *handlesnull* (``bool``) --
Defines if this expression has custom handling for NULL values. If False, the result will always be NULL as soon as any parameter is NULL. False by default.
Example: Example:
@qgsfunction(2, 'test'): @qgsfunction(2, 'test'):
def add(values, feature, parent): def add(values, feature, parent):