16#include "moc_qgsfieldconstraints.cpp"
22 if ( !( mConstraints & constraint ) )
30 if ( !( mConstraints & constraint ) )
41 mConstraintStrengths.remove( constraint );
45 mConstraintStrengths.insert( constraint, strength );
53 mConstraints &= ~constraint;
54 mConstraintOrigins.remove( constraint );
55 mConstraintStrengths.remove( constraint );
59 mConstraints |= constraint;
60 mConstraintOrigins.insert( constraint, origin );
61 if ( !mConstraintStrengths.contains( constraint ) )
75 if ( expression.isEmpty() )
83 mExpressionConstraint = expression;
84 mExpressionConstraintDescription = description;
89 return mConstraints == other.mConstraints && mConstraintOrigins == other.mConstraintOrigins
90 && mExpressionConstraint == other.mExpressionConstraint && mExpressionConstraintDescription == other.mExpressionConstraintDescription
91 && mConstraintStrengths == other.mConstraintStrengths
92 && mDomainName == other.mDomainName;
Stores information about constraints which may be present on a field.
ConstraintStrength
Strength of constraints.
@ ConstraintStrengthNotSet
Constraint is not set.
@ ConstraintStrengthHard
Constraint must be honored before feature can be accepted.
void setConstraintStrength(Constraint constraint, ConstraintStrength strength)
Sets the strength of a constraint.
void setConstraintExpression(const QString &expression, const QString &description=QString())
Set the constraint expression for the field.
ConstraintOrigin
Origin of constraints.
@ ConstraintOriginNotSet
Constraint is not set.
@ ConstraintOriginLayer
Constraint was set by layer.
ConstraintStrength constraintStrength(Constraint constraint) const
Returns the strength of a field constraint, or ConstraintStrengthNotSet if the constraint is not pres...
ConstraintOrigin constraintOrigin(Constraint constraint) const
Returns the origin of a field constraint, or ConstraintOriginNotSet if the constraint is not present ...
QString constraintExpression() const
Returns the constraint expression for the field, if set.
bool operator==(const QgsFieldConstraints &other) const
Constraint
Constraints which may be present on a field.
@ ConstraintExpression
Field has an expression constraint set. See constraintExpression().
void setConstraint(Constraint constraint, ConstraintOrigin origin=ConstraintOriginLayer)
Sets a constraint on the field.
QgsFieldConstraints()
Constructor for QgsFieldConstraints.