Hi Jürgen, your solution works.
Thank you Enrico >----Messaggio originale---- >Da: [email protected] >Data: 19/05/2015 16.08 >A: <[email protected]> >Ogg: Re: [Qgis-developer] How to get feature frome deleted feature? > >Hi Enrico, > >On Tue, 19. May 2015 at 14:38:35 +0200, Enrico Fiore wrote: >> layer.committedFeaturesRemoved.connect(ConfirmTratDeleted) >> >> def ConfirmTratDeleted(layer,fids): >> for fid in fids: >> iter = layer.getFeatures(QgsFeatureRequest().setFilterFid(fid)) >> feat = iter.next() >> geometry = feat.geometry() >> >> but it returned thi error: >> >> An error has occured while executing Python code: >> >> Traceback (most recent call last): >> File "", line 234, in ConfirmTratDeleted >> StopIteration >> >> I suppose because the features are committed and don't exist anymore. >> >> Somebody can help me to understand how to get features that were deleted? > >committedFeaturesRemoved notifies you that the feature were actually removed - >so they don't exists anymore. But you can use the featureDeleted signal >that provides a feature id of a (to be) deleted feature and use that >to fetch it from the provider (layer.dataProvider().getFeatures...) > >If you actually need the features after the are actually deleted, you can >store them in the featureDeleted slot and use the saved copy to in your >committedFeaturesRemoved slot. > > > >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
