Subgroup: Field
Class: QgsFieldConstraints¶
-
class
qgis.core.
QgsFieldConstraints
¶ Bases:
sip.wrapper
Constructor for QgsFieldConstraints.
QgsFieldConstraints(QgsFieldConstraints)
Stores information about constraints which may be present on a field.
New in version 3.0: Methods
constraintDescription
Returns the descriptive name for the constraint expression. constraintExpression
Returns the constraint expression for the field, if set. constraintOrigin
Returns the origin of a field constraint, or ConstraintOriginNotSet if the constraint is not present on this field. constraintStrength
Returns the strength of a field constraint, or ConstraintStrengthNotSet if the constraint is not present on this field. constraints
Returns any constraints which are present for the field. removeConstraint
Removes a constraint from the field. setConstraint
Sets a constraint on the field. setConstraintExpression
Set the constraint expression for the field. setConstraintStrength
Sets the strength of a constraint. Signals
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
¶ Bases:
sip.wrapper
QgsFieldConstraints.Constraints(Union[QgsFieldConstraints.Constraints, QgsFieldConstraints.Constraint]) QgsFieldConstraints.Constraints(QgsFieldConstraints.Constraints)
-
constraintDescription
(self) → str¶ Returns the descriptive name for the constraint expression.
See also
See also
See also
-
constraintExpression
(self) → str¶ Returns the constraint expression for the field, if set.
See also
See also
See also
-
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
-
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
-
constraints
(self) → QgsFieldConstraints.Constraints¶ Returns any constraints which are present for the field.
See also
See also
-
removeConstraint
(self, constraint: QgsFieldConstraints.Constraint)¶ Removes a constraint from the field.
See also
See also
-
setConstraint
(self, constraint: QgsFieldConstraints.Constraint, origin: QgsFieldConstraints.ConstraintOrigin = QgsFieldConstraints.ConstraintOriginLayer)¶ Sets a constraint on the field.
See also
See also
-
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
-
setConstraintStrength
(self, constraint: QgsFieldConstraints.Constraint, strength: QgsFieldConstraints.ConstraintStrength)¶ 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.
See also
-
staticMetaObject
= <PyQt5.QtCore.QMetaObject object>¶
-
class