[Qgis-developer] How to get feature frome deleted feature?

Enrico Fiore enricofiore at libero.it
Tue May 19 05:38:35 PDT 2015

is there a pyqgis solution to fetch the features that are canceled with 
"delete selected features" tool?

I used this code in "Project Properties --> Macro":

layer = iface.activeLayer()

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

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?

Thank you in advance


More information about the Qgis-developer mailing list