Questions tagged «stopiteration»

1
如何访问已删除的功能属性(提交之前)
我为图层上的功能删除事件设置了信号: self.layer.featureDeleted.connect(self.feature_deleted) 当我尝试从插槽上已删除的功能中获取属性时,会引发StopIteration错误(即,它无法检索该功能)。 我以为在提交对图层的更改之前,我仍然应该能够从已删除的要素中检索属性?否则,我看不到fid参数的用途。 def feature_deleted(self, fid): feature = self.layer.getFeatures(QgsFeatureRequest().setFilterFid(int(fid))).next() idx = self.layer.fieldNameIndex('my_attribute') print feature.attributes()[idx] 我如何访问已删除要素的属性(在提交对图层的更改之前)?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.