16 #ifndef QGSFIELDCONSTRAINTS_H 17 #define QGSFIELDCONSTRAINTS_H 23 #include "qgis_core.h" 36 Q_PROPERTY( Constraints constraints READ constraints )
45 ConstraintNotNull = 1,
46 ConstraintUnique = 1 << 1,
47 ConstraintExpression = 1 << 2,
56 ConstraintOriginNotSet = 0,
66 ConstraintStrengthNotSet = 0,
126 QString constraintExpression()
const;
143 void setConstraintExpression(
const QString &expression,
const QString &description = QString() );
150 Constraints mConstraints =
nullptr;
153 QHash< Constraint, ConstraintOrigin > mConstraintOrigins;
156 QHash< Constraint, ConstraintStrength > mConstraintStrengths;
159 QString mExpressionConstraint;
162 QString mExpressionConstraintDescription;
165 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsFieldConstraints::Constraints )
167 #endif //QGSFIELDCONSTRAINTS_H Constraint was set by layer.
Constraint
Constraints which may be present on a field.
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
ConstraintOrigin
Origin of constraints.
Stores information about constraints which may be present on a field.
Constraint was set at data provider.
QString constraintDescription() const
Returns the descriptive name for the constraint expression.
User is warned if constraint is violated but feature can still be accepted.
ConstraintStrength
Strength of constraints.
Constraints constraints() const
Returns any constraints which are present for the field.
Constraint must be honored before feature can be accepted.
void removeConstraint(Constraint constraint)
Removes a constraint from the field.