| QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
    | 
The QgsDefaultValue class provides a container for managing client side default values for fields. More...
#include <qgsdefaultvalue.h>
| Public Member Functions | |
| QgsDefaultValue (const QString &expression=QString(), bool applyOnUpdate=false) | |
| Create a new default value with the given expression and applyOnUpdate flag.  More... | |
| bool | applyOnUpdate () const | 
| The applyOnUpdate flag determines if this expression should also be applied when a feature is updated or only when it's created.  More... | |
| QString | expression () const | 
| The expression will be evaluated whenever a default value needs to be calculated for a field.  More... | |
| bool | isValid () const | 
| Returns if this default value should be applied.  More... | |
| operator bool () const SIP_PYTHON_SPECIAL_BOOL(isValid) | |
| Checks if a default value is set.  More... | |
| bool | operator== (const QgsDefaultValue &other) const | 
| void | setApplyOnUpdate (bool applyOnUpdate) | 
| The applyOnUpdate flag determines if this expression should also be applied when a feature is updated or only when it's created.  More... | |
| void | setExpression (const QString &expression) | 
| The expression will be evaluated whenever a default value needs to be calculated for a field.  More... | |
| Properties | |
| bool | applyOnUpdate | 
| Q_GADGET QString | expression | 
The QgsDefaultValue class provides a container for managing client side default values for fields.
A QgsDefaultValue consists of an expression string that will be evaluated on the client when a default field value needs to be generated.
Usual values for such an expression are
@some_variable to insert a project or application level variable like the username of the one digitizing a feature$length to insert a derived attribute of a geometryQgsDefaultValue also has a applyOnUpdate flag which will indicate that a default value should also be applied when a feature is updated. If this is not set, the default value will only be used when a feature is created.
Definition at line 48 of file qgsdefaultvalue.h.
| 
 | explicit | 
Create a new default value with the given expression and applyOnUpdate flag.
Definition at line 18 of file qgsdefaultvalue.cpp.
| bool QgsDefaultValue::applyOnUpdate | ( | ) | const | 
The applyOnUpdate flag determines if this expression should also be applied when a feature is updated or only when it's created.
Definition at line 41 of file qgsdefaultvalue.cpp.
| QString QgsDefaultValue::expression | ( | ) | const | 
The expression will be evaluated whenever a default value needs to be calculated for a field.
Definition at line 31 of file qgsdefaultvalue.cpp.
| bool QgsDefaultValue::isValid | ( | ) | const | 
Returns if this default value should be applied.
false if the expression is a null string. Definition at line 51 of file qgsdefaultvalue.cpp.
| QgsDefaultValue::operator bool | ( | ) | const | 
Checks if a default value is set.
Alias for isValid().
false if the expression is a null string. Definition at line 56 of file qgsdefaultvalue.cpp.
| bool QgsDefaultValue::operator== | ( | const QgsDefaultValue & | other | ) | const | 
Definition at line 25 of file qgsdefaultvalue.cpp.
| void QgsDefaultValue::setApplyOnUpdate | ( | bool | applyOnUpdate | ) | 
The applyOnUpdate flag determines if this expression should also be applied when a feature is updated or only when it's created.
Definition at line 46 of file qgsdefaultvalue.cpp.
| void QgsDefaultValue::setExpression | ( | const QString & | expression | ) | 
The expression will be evaluated whenever a default value needs to be calculated for a field.
Definition at line 36 of file qgsdefaultvalue.cpp.
| 
 | readwrite | 
Definition at line 50 of file qgsdefaultvalue.h.
| 
 | readwrite | 
Definition at line 50 of file qgsdefaultvalue.h.