qwat / QWAT

TEKSI Water module (project QWAT) - QGIS project
https://www.teksi.ch
GNU General Public License v2.0
58 stars 31 forks source link

Adding year constraint on widgets doesn't work when relation_reference widgets are present #144

Closed tudorbarascu closed 8 years ago

tudorbarascu commented 8 years ago

As we already have in the database model the (year IS NULL OR year > 1800 AND year < 2100); constraint on pipes I thought of putting this constraint on QGIS side on this form: "year" IS NULL OR 1800 <= "year" AND "year" <= now().

I discovered that this doesn't work at all when "relation reference" widgets are present. If the "relation reference" widget is orphaned (by deleting the relation in project properties -> relations then the constraint works as it should. You can test this by adding the above constraint on pipe.year and by removing the relations in the project.

@pblottiere Any ideas why this doesn't work in the presence of working relation widgets?

pblottiere commented 8 years ago

@tudorbarascu Indeed, I reproduce the same thing here on master_2.

By the way, I noticed that the size of the "warning" icon is now far too big within the the form:

warning

I'm going to do some more digging and get back to you.

pblottiere commented 8 years ago

@tudorbarascu I have made some minor fixes last week on constraints https://github.com/pblottiere/QGIS/tree/fix_constraints. Regarding the strange behaviour with relation widgets , it was just a boolean issue...

I wanted to do a PR but Nyall is obviously working on the refactoring to add new features for constraints handling: https://github.com/qgis/QGIS/pull/3673

m-kuhn commented 8 years ago

Fixed in the 2.18 bug fixing round (constraints not working and icon size)

tudorbarascu commented 8 years ago

Just tested and it works. Thanks!