Now I've got another problem, the committedAttributeValuesChanges and committedGeometriesChanges signals of QgsVectorLayer don't seem to fire when I change attributes or geometries... I'm not sure if I'm hitting a bug or if there's something else I don't understand, but this time the problem doesnt come from views (it appears also on normal tables).
Here's my test case (to be run in the python console, with a vector layer selected) : > def testFeaturesAdded(a, b): > QgsMessageLog.logMessage( 'committedFeaturesAdded was triggered' ) > > def testFeaturesRemoved(a, b): > QgsMessageLog.logMessage( 'committedFeaturesRemoved was triggered' ) > > def testAttributeValuesChanges(a, b): > QgsMessageLog.logMessage( 'committedAttributeValuesChanges was > triggered' ) > > def testGeometriesChanges(a, b): > QgsMessageLog.logMessage( 'committedGeometriesChanges was triggered' ) > > iface.activeLayer().committedFeaturesAdded.connect( testFeaturesAdded ) > iface.activeLayer().committedFeaturesRemoved.connect( testFeaturesRemoved ) > iface.activeLayer().committedAttributeValuesChanges.connect( > testAttributeValuesChanges ) > iface.activeLayer().committedGeometriesChanges.connect( testGeometriesChanges > ) I get messages on committed creation and deletion of features, but not on modifications... Is it a bug ? If someone confirms, I'll file a ticket... (I tested under master and 2.8.1) Best regards, Olivier 2015-03-19 1:09 GMT+01:00 Olivier Dalang <[email protected]>: > Jürgen, > > I've been able to solve my problem by adding a default value on my view > (and by also forwarding the ID in the insert trigger) : > >> ALTER VIEW test_view ALTER COLUMN id SET DEFAULT nextval('test_id_seq'); > > > I updated the gist just in case : > https://gist.github.com/olivierdalang/cad70df2d463d0b87566 > > Thank you very much for your help :) > > Olivier > > > > On Mar 18, 2015 7:17 PM, "Jürgen E." <[email protected]> wrote: > >> Hi Olivier, >> >> On Wed, 18. Mar 2015 at 18:40:20 +0100, Olivier Dalang wrote: >> > Am I doing something wrong ? >> >> Not really - just something that isn't expected. >> >> > Or is QGIS using some other way to get back the ID of a new feature ? >> Any >> > idea of what that could be ? >> >> It retrieves the default values for all attributes (which might be a call >> to >> nextval), executes them and uses the result for the insert. So it knows >> the id before the insert and can update the feature with it. >> >> >> Jürgen >> >> -- >> Jürgen E. Fischer norBIT GmbH Tel. >> +49-4931-918175-31 >> Dipl.-Inf. (FH) Rheinstraße 13 Fax. >> +49-4931-918175-50 >> Software Engineer D-26506 Norden >> http://www.norbit.de >> QGIS release manager (PSC) Germany IRC: jef on >> FreeNode >> >> _______________________________________________ >> Qgis-developer mailing list >> [email protected] >> http://lists.osgeo.org/mailman/listinfo/qgis-developer >> >
_______________________________________________ Qgis-developer mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-developer
