[Qgis-developer] problem with feature request and updateFeature
Jürgen E. Fischer
jef at norbit.de
Fri Mar 22 08:21:50 PDT 2013
Hi Nathan,
On Sat, 23. Mar 2013 at 00:29:03 +1000, Nathan Woodrow wrote:
> If updateFeature is indeed doing feature request inside and breaking the loop
> then that is a bug. updateFeature should not affect the feature
The misfeature is that there can only be one active iterator per provider (see
also [1]). So the feature iterator in updateFeature closes the iterator of the
loop.
> What should I do if I want to modify features during the loop?
replacing
> f.setAttribute( field, QVariant( 1 ) )
> vectorLayer.updateFeature( f )
with
vectorLayer.changeAttributeValue( f.id(), field, 1 )
should help.
Jürgen
[1] http://hub.qgis.org/issues/7071#note-6
--
Jürgen E. Fischer norBIT GmbH Tel. +49-4931-918175-31
Dipl.-Inf. (FH) Rheinstraße 13 Fax. +49-4931-918175-50
Software Engineer D-26506 Norden http://www.norbit.de
committ(ed|ing) to Quantum GIS IRC: jef on FreeNode
--
norBIT Gesellschaft fuer Unternehmensberatung und Informationssysteme mbH
Rheinstrasse 13, 26506 Norden
GF: Jelto Buurman, HR: Amtsgericht Emden, HRB 5502
More information about the Qgis-developer
mailing list