<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Dear QGIS Gurus:<br>I have a written a plugin that updates an attribute of a shape file and it tells me it ran fine and yet, I am not able to see the changes in the attribute table once the program finishes. I am using QGIS 1.6 Copiapo on Windows). I am compiling using the 1.7 source, but I have tried using the trunk version and it does not seem to matter at all.<br><br>I can see the edit starting with all the extent selected and it finishes without an error. I also write a log file before and after the feature attribute change and the feature values change correctly.<br>What am i doing wrong?<br><br>The simplified code is posted below,<br><br><code> QgsVectorDataProvider* vProvider = theVectorLayer->dataProvider();<br> theVectorLayer->select(vProvider->attributeIndexes(),
<br> theVectorLayer->extent(), true, false);<br> QgsFeature currentFeature;<br> QgsGeometry* currentGeometry = 0;<br> bool blnEdit = theVectorLayer->startEditing();<br> QgsAttributeList attrList = vProvider->attributeIndexes();<br> vProvider->select(attrList);<br> blnFeat = vProvider->nextFeature(currentFeature);<br> QgsAttributeMap atMap1;<br> vProvider->createSpatialIndex();<br> QgsAttributeList attrList = vProvider->attributeIndexes();<br> vProvider->select(attrList);<br> blnFeat =
vProvider->nextFeature(currentFeature);<br> QgsAttributeMap atMap1;<br> QString featureAttributesString;<br> int ltsVal = 10;<br> int ltsFldIdx = 1;<br> QVariant fld0 ;<br> while(blnFeat)<br> {<br> atMap1 = currentFeature.attributeMap();<br> fld0 = atMap1.value(0);<br> currentGeometry = currentFeature.geometry();<br> if(!currentGeometry)<br> {<br> continue;<br> } <br>
else<br> {<br> currentFeature.changeAttribute(ltsFldIdx,QVariant(ltsVal)); <br> }<br> blnFeat = vProvider->nextFeature(currentFeature);<br> }<br> blnAttrAdded = theVectorLayer->commitChanges();<br> theVectorLayer->endEditCommand();<br></code></td></tr></table>