Class: QgsFieldConstraints¶
- class qgis.core.QgsFieldConstraints¶
Bases:
sip.wrapper
Stores information about constraints which may be present on a field.
QgsFieldConstraints() Constructor for QgsFieldConstraints.
QgsFieldConstraints(
QgsFieldConstraints
)Methods
Returns the descriptive name for the constraint expression.
Returns the constraint expression for the field, if set.
Returns the origin of a field constraint, or ConstraintOriginNotSet if the constraint is not present on this field.
Returns the strength of a field constraint, or ConstraintStrengthNotSet if the constraint is not present on this field.
Returns any constraints which are present for the field.
Returns the associated field domain name, for providers which support field domains.
Removes a constraint from the field.
Sets a constraint on the field.
Set the constraint expression for the field.
Sets the strength of a constraint.
Sets the associated field
domain
name, for providers which support field domains.Attributes
- class Constraint¶
Bases:
int
- ConstraintExpression = 4¶
- ConstraintNotNull = 1¶
- class ConstraintOrigin¶
Bases:
int
- ConstraintOriginLayer = 2¶
- ConstraintOriginNotSet = 0¶
- ConstraintOriginProvider = 1¶
- class ConstraintStrength¶
Bases:
int
- ConstraintStrengthHard = 1¶
- ConstraintStrengthNotSet = 0¶
- ConstraintStrengthSoft = 2¶
- ConstraintUnique = 2¶
- class Constraints¶
- class Constraints(Union[QgsFieldConstraints.Constraints, QgsFieldConstraints.Constraint])
- class Constraints(QgsFieldConstraints.Constraints)
Bases:
sip.wrapper
- constraintDescription(self) str ¶
Returns the descriptive name for the constraint expression.
See also
See also
See also
- Return type:
str
- constraintExpression(self) str ¶
Returns the constraint expression for the field, if set.
See also
See also
See also
- Return type:
str
- constraintOrigin(self, constraint: QgsFieldConstraints.Constraint) QgsFieldConstraints.ConstraintOrigin ¶
Returns the origin of a field constraint, or ConstraintOriginNotSet if the constraint is not present on this field.
See also
- Parameters:
constraint (QgsFieldConstraints.Constraint) –
- Return type:
- constraintStrength(self, constraint: QgsFieldConstraints.Constraint) QgsFieldConstraints.ConstraintStrength ¶
Returns the strength of a field constraint, or ConstraintStrengthNotSet if the constraint is not present on this field.
See also
See also
- Parameters:
constraint (QgsFieldConstraints.Constraint) –
- Return type:
- constraints(self) QgsFieldConstraints.Constraints ¶
Returns any constraints which are present for the field.
See also
See also
- Return type:
- domainName(self) str ¶
Returns the associated field domain name, for providers which support field domains.
See also
New in version 3.26.
- Return type:
str
- removeConstraint(self, constraint: QgsFieldConstraints.Constraint)¶
Removes a constraint from the field.
See also
See also
- Parameters:
constraint (QgsFieldConstraints.Constraint) –
- setConstraint(self, constraint: QgsFieldConstraints.Constraint, origin: QgsFieldConstraints.ConstraintOrigin = QgsFieldConstraints.ConstraintOriginLayer)¶
Sets a constraint on the field.
See also
See also
- Parameters:
constraint (QgsFieldConstraints.Constraint) –
origin (QgsFieldConstraints.ConstraintOrigin = QgsFieldConstraints.ConstraintOriginLayer) –
- setConstraintExpression(self, expression: str, description: str = '')¶
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.
See also
See also
See also
- Parameters:
expression (str) –
description (str = '') –
- setConstraintStrength(self, constraint: QgsFieldConstraints.Constraint, strength: QgsFieldConstraints.ConstraintStrength)¶
Sets the strength of a constraint. Constraints default to ConstraintStrengthHard unless explicitly changed.
See also
- Parameters:
constraint (QgsFieldConstraints.Constraint) –
strength (QgsFieldConstraints.ConstraintStrength) –
- setDomainName(self, domain: str)¶
Sets the associated field
domain
name, for providers which support field domains.See also
New in version 3.26.
- Parameters:
domain (str) –
- staticMetaObject = <PyQt5.QtCore.QMetaObject object>¶