I try to detect, if a newly created feature is snapped according the snap options:
def isSnapped(self,feat):
try:
snapper = QgsSnappingUtils(self.iface.mapCanvas())
snapper.setMapSettings(self.iface.mapCanvas().mapSettings())
pointxy = QgsGeometry(feat.geometry()).asPoint()
#qPoint = QPoint(pointxy.x(),pointxy.y())
matchres = snapper.snapToMap(pointxy)# QgsPointLocator.Match
if self.debug:self.info.log("snapping",matchres is None)
if self.debug: self.info.log("snapping", matchres )
if self.debug: self.info.log("snapping",matchres.distance(),matchres.point(),matchres.isValid (),matchres.hasVertex () )
except Exception as e:
self.info.err(e)
But for any reasons, I always get the same results, eihter the feature is snapped or not. What I am missing? Please help!