QGIS/python/core/auto_generated/qgsdefaultvalue.sip.in

91 lines
3.0 KiB
Plaintext
Raw Normal View History

2017-09-19 17:36:19 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsdefaultvalue.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsDefaultValue
{
%Docstring
The QgsDefaultValue class provides a container for managing client
2017-12-15 10:36:55 -04:00
side default values for fields.
2017-09-19 17:36:19 +02:00
2017-12-15 10:36:55 -04:00
A QgsDefaultValue consists of an expression string that will be evaluated
on the client when a defeault field value needs to be generated.
2017-09-19 17:36:19 +02:00
2017-12-15 10:36:55 -04:00
Usual values for such an expression are
2017-09-19 17:36:19 +02:00
2017-12-15 10:36:55 -04:00
- `now()` for a timestamp for a record
- `@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 geometry
2017-09-19 17:36:19 +02:00
2017-12-15 10:36:55 -04:00
QgsDefaultValue 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.
2017-09-19 17:36:19 +02:00
.. versionadded:: 3.0
%End
%TypeHeaderCode
#include "qgsdefaultvalue.h"
%End
public:
explicit QgsDefaultValue( const QString &expression = QString(), bool applyOnUpdate = false );
2017-09-19 17:36:19 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Create a new default value with the given ``expression`` and ``applyOnUpdate`` flag.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`QgsVectorLayer.setDefaultValueDefinition`
2017-09-19 17:36:19 +02:00
%End
bool operator==( const QgsDefaultValue &other ) const;
QString expression() const;
%Docstring
2017-12-15 10:36:55 -04:00
The expression will be evaluated whenever a default value needs
to be calculated for a field.
2017-09-19 17:36:19 +02:00
%End
void setExpression( const QString &expression );
%Docstring
2017-12-15 10:36:55 -04:00
The expression will be evaluated whenever a default value needs
to be calculated for a field.
2017-09-19 17:36:19 +02:00
%End
bool applyOnUpdate() const;
%Docstring
2017-12-15 10:36:55 -04:00
The applyOnUpdate flag determines if this expression should also be
applied when a feature is updated or only when it's created.
2017-09-19 17:36:19 +02:00
%End
void setApplyOnUpdate( bool applyOnUpdate );
%Docstring
2017-12-15 10:36:55 -04:00
The applyOnUpdate flag determines if this expression should also be
applied when a feature is updated or only when it's created.
2017-09-19 17:36:19 +02:00
%End
bool isValid() const;
%Docstring
2017-12-15 10:36:55 -04:00
Returns if this default value should be applied.
:return: false if the expression is a null string.
%End
2017-09-26 13:35:05 +02:00
2017-09-19 17:36:19 +02:00
};
2017-09-19 17:36:19 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsdefaultvalue.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/