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,
49 Q_DECLARE_FLAGS( Constraints, Constraint )
56 ConstraintOriginNotSet = 0,
66 ConstraintStrengthNotSet = 0,
88 ConstraintOrigin constraintOrigin( Constraint constraint )
const;
96 ConstraintStrength constraintStrength( Constraint constraint )
const;
103 void setConstraintStrength( Constraint constraint, ConstraintStrength strength );
110 void setConstraint( Constraint constraint, ConstraintOrigin origin = ConstraintOriginLayer );
125 QString constraintExpression()
const;
142 void setConstraintExpression(
const QString &expression,
const QString &description = QString() );
149 Constraints mConstraints;
152 QHash< Constraint, ConstraintOrigin > mConstraintOrigins;
155 QHash< Constraint, ConstraintStrength > mConstraintStrengths;
158 QString mExpressionConstraint;
161 QString mExpressionConstraintDescription;
164 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsFieldConstraints::Constraints )
166 #endif //QGSFIELDCONSTRAINTS_H