<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi Germán,<br>
<br>
I think some edit widgets have effects like this, when an
unsupported value is set on them, they will just convert it to a
supported one and change it.<br>
Like some widgets may not support NULL values so they just change it
to something else.<br>
Please check which field is affected, what edit type is set and
what's the value of the first (topmost) feature on the attribute
table for this field.<br>
<br>
Thanks<br>
Matthias<br>
<br>
<div class="moz-cite-prefix">On 13/07/16 00:33, Germán Carrillo
wrote:<br>
</div>
<blockquote
cite="mid:CANaz7mybUiz7iH2pE2K725eKWp8n+g8UHP8vAwAP-6KQ-7cbKQ@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>Hi All, <br>
<br>
I'm working on a plugin and trying to connect a SLOT to
layer.attributeValueChanged SIGNAL. However, I found that such
SIGNAL is (weirdly) emitted in the following scenario:<br>
<br>
1. Load a vector file (I've tested this with a Shapefile and
an SQLITE file) with a numeric (int or real) field, whose
value for the first feature is NULL.<br>
2. Open the attribute table of the vector layer.<br>
3. Start an edit session cliking on "Toggle Edit Mode" button
from the Attribute table window.<br>
<br>
As soon as the edit session starts, the SIGNAL is emitted.
Now, if I click on the "Toggle Edit Mode" button from the
Attribute table window, I have to choose among Save, Cancel,
or Close Without Saving options, even without changing any
attribute value at all. Once I choose Close Without Saving,
the layer.attributeValueChanged SIGNAL is emitted once more.<br>
<br>
Such behavior is hampering my plugin, which will depend on the
aforementioned SIGNAL.<br>
<br>
Is this a bug? Do you know why layer.attributeValueChanged is
being emitted in such scenario? I've noticed that sometimes a
blockSignals() method is used in QGIS source code; couldn't we
use blockSignals() to avoid emitting the SIGNAL in this case?<br>
<br>
######################################<br>
Note: I use this code snippet in the QGIS Python console to be
notified when layer.attributeValueChanged is emitted:<br>
<br>
##<br>
def f(fid, idx, value):<br>
print fid,idx,value<br>
<br>
</div>
<div>l = iface.activeLayer()<br>
l.attributeValueChanged.connect( f )<br>
##</div>
<div><br>
I'm getting these messages printed (4 is the index of the
numeric field whose value for the first feature is NULL):<br>
<br>
0 4 NULL # When I open the edit session.<br>
0 4 NULL # When I close the edit session.</div>
<div><br>
</div>
<div>If you want to reproduce the problem, you can use a sample
Shapefile from here: <a moz-do-not-send="true"
href="http://downloads.tuxfamily.org/tuxgis/tmp/test.zip">http://downloads.tuxfamily.org/tuxgis/tmp/test.zip</a><br>
######################################<br>
<br>
<br>
Regards,<br>
<br>
Germán<br>
</div>
<br clear="all">
<div><br>
</div>
-- <br>
<div class="gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr">
<div>-----------<br>
</div>
<div> |\__ <br>
(:>__)(<br>
|/ <br>
Soluciones Geoinformáticas Libres
<br>
<a moz-do-not-send="true"
href="http://geotux.tuxfamily.org/"
target="_blank">http://geotux.tuxfamily.org/</a><br>
<a moz-do-not-send="true"
href="http://twitter.com/GeoTux2" target="_blank">http://twitter.com/GeoTux2</a></div>
<div><a moz-do-not-send="true"
href="http://about.me/germancarrillo"
target="_blank">http://about.me/germancarrillo</a><br>
</div>
<div>
<div><br>
</div>
<div><a moz-do-not-send="true"
href="http://gis.stackexchange.com/users/4972/germ%c3%a1n-carrillo"
target="_blank"><img moz-do-not-send="true"
src="http://gis.stackexchange.com/users/flair/4972.png"></a></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Qgis-developer mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/qgis-developer">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/qgis-developer">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a></pre>
</blockquote>
<br>
</body>
</html>