literal defaults, and qgis expression defaults) and automatically
handle unique value constraints on layers
Add a new method QgsVectorLayerUtils::createFeature which returns
a new feature which includes all relevant defaults. Any fields
with unique value constraints will be guaranteed to have a value
which is unique for the field.
Currently only in use by the split feature tool.
Sponsored by Canton of Zug and the QGEP project
Returns a new unique attribute value for a layer. For numeric
fields this is the max attribute value + 1, for strings we
attempt to create a unique value by append _1, _2, etc to either
a specified 'seed' value, or failing that to the end of the
value of that field from the first feature in the layer.
Warnings are shown, but features can be committed. Fields which
fail an unenforced constraint are now shaded in yellow to differentiate
from the red failure for enforced constraints.
and not any constraints enforced by the provider
Because:
1. we want to keep browsing features nice and responsive. It's nice to give
feedback as to whether the value checks out, but not if it's too slow to
do so. Some constraints (eg unique) can be expensive to test. A user can
freely remove a layer-based constraint if it proves to be too slow to
test, but they are unlikely to have any control over provider-side
constraints
2. the provider has already accepted the value, so presumably it doesn't
violate the constraint and there's no point rechecking!
Contains static helper methods for working with vector layers.
Initially only contains a method to test whether a value
exists within a layer's attributes.