Get the identified feature
This is a simple code for connect your QgsMapToolIdentifyFeature signal.
from qgis.gui import QgsMapToolIdentifyFeature
def onFeatureIdentified(feature):
print "feature selected : "+ str(feature.id())
mapTool = None
mc=iface.mapCanvas()
lyr=iface.activeLayer()
mapTool = QgsMapToolIdentifyFeature(mc)
mapTool.setLayer(lyr)
mc.setMapTool(mapTool)
mapTool.featureIdentified.connect(onFeatureIdentified)
And when click in a feature print the id.
Regards
Tested with QGIS 2.18.14 on W10
UPDATE: Add GIF with QGIS 2.18.13
To stick with your code :
def onFeatureIdentified(self, ff):
print("feature selected")
def run(self):
mCanvas = self.iface.mapCanvas()
f = QgsMapToolIdentifyFeature(mCanvas, self.iface.activeLayer())
mCanvas.setMapTool(f)
f.featureIdentified.connect(self.onFeatureIdentified)