QGIS/python/core/qgsfieldconstraints.sip

141 lines
4.4 KiB
Plaintext
Raw Normal View History

2017-05-01 12:58:31 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsfieldconstraints.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsFieldConstraints
{
2017-05-01 12:58:31 +02:00
%Docstring
Stores information about constraints which may be present on a field.
.. versionadded:: 3.0
%End
%TypeHeaderCode
2017-05-01 12:58:31 +02:00
#include "qgsfieldconstraints.h"
%End
public:
enum Constraint
{
2017-05-01 12:58:31 +02:00
ConstraintNotNull,
ConstraintUnique,
ConstraintExpression,
};
typedef QFlags<QgsFieldConstraints::Constraint> Constraints;
2017-05-01 12:58:31 +02:00
enum ConstraintOrigin
{
2017-05-01 12:58:31 +02:00
ConstraintOriginNotSet,
ConstraintOriginProvider,
ConstraintOriginLayer,
};
enum ConstraintStrength
{
2017-05-01 12:58:31 +02:00
ConstraintStrengthNotSet,
ConstraintStrengthHard,
ConstraintStrengthSoft,
};
QgsFieldConstraints();
2017-05-01 12:58:31 +02:00
%Docstring
Constructor for QgsFieldConstraints.
%End
Constraints constraints() const;
2017-05-01 12:58:31 +02:00
%Docstring
Returns any constraints which are present for the field.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setConstraints()`
.. seealso:: :py:func:`constraintOrigin()`
2017-05-01 12:58:31 +02:00
:rtype: Constraints
%End
ConstraintOrigin constraintOrigin( Constraint constraint ) const;
2017-05-01 12:58:31 +02:00
%Docstring
Returns the origin of a field constraint, or ConstraintOriginNotSet if the constraint
is not present on this field.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`constraints()`
2017-05-01 12:58:31 +02:00
:rtype: ConstraintOrigin
%End
ConstraintStrength constraintStrength( Constraint constraint ) const;
2017-05-01 12:58:31 +02:00
%Docstring
Returns the strength of a field constraint, or ConstraintStrengthNotSet if the constraint
is not present on this field.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`constraints()`
.. seealso:: :py:func:`setConstraintStrength()`
2017-05-01 12:58:31 +02:00
:rtype: ConstraintStrength
%End
void setConstraintStrength( Constraint constraint, ConstraintStrength strength );
2017-05-01 12:58:31 +02:00
%Docstring
Sets the strength of a constraint. Note that the strength of constraints which originate
from a provider cannot be changed. Constraints default to ConstraintStrengthHard unless
explicitly changed.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`constraintStrength()`
2017-05-01 12:58:31 +02:00
%End
void setConstraint( Constraint constraint, ConstraintOrigin origin = ConstraintOriginLayer );
2017-05-01 12:58:31 +02:00
%Docstring
Sets a constraint on the field.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`constraints()`
.. seealso:: :py:func:`removeConstraint()`
2017-05-01 12:58:31 +02:00
%End
void removeConstraint( Constraint constraint );
2017-05-01 12:58:31 +02:00
%Docstring
Removes a constraint from the field.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`setConstraint()`
.. seealso:: :py:func:`constraints()`
2017-05-01 12:58:31 +02:00
%End
QString constraintExpression() const;
2017-05-01 12:58:31 +02:00
%Docstring
Returns the constraint expression for the field, if set.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`constraints()`
.. seealso:: :py:func:`constraintDescription()`
.. seealso:: :py:func:`setConstraintExpression()`
2017-05-01 12:58:31 +02:00
:rtype: str
%End
QString constraintDescription() const;
2017-05-01 12:58:31 +02:00
%Docstring
Returns the descriptive name for the constraint expression.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`constraints()`
.. seealso:: :py:func:`constraintExpression()`
.. seealso:: :py:func:`setConstraintExpression()`
2017-05-01 12:58:31 +02:00
:rtype: str
%End
2017-05-01 12:58:31 +02:00
void setConstraintExpression( const QString &expression, const QString &description = QString() );
%Docstring
Set the constraint expression for the field. An optional descriptive name for the constraint
can also be set. Setting an empty expression will clear any existing expression constraint.
2017-12-05 20:04:14 -04:00
.. seealso:: :py:func:`constraintExpression()`
.. seealso:: :py:func:`constraintDescription()`
.. seealso:: :py:func:`constraints()`
2017-05-01 12:58:31 +02:00
%End
2017-05-01 12:58:31 +02:00
bool operator==( const QgsFieldConstraints &other ) const;
};
QFlags<QgsFieldConstraints::Constraint> operator|(QgsFieldConstraints::Constraint f1, QFlags<QgsFieldConstraints::Constraint> f2);
2017-05-01 12:58:31 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsfieldconstraints.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/