<div dir="ltr">Hi Matthias, <div><br></div><div><br></div><div style="">thanks for the response. </div><div style=""><br></div><div style="">In the first message I've included a link to a sample Shapefile. It has a single field (called id) with these properties: type:int, type name:Integer, length:10, precision:0, fieldIndex:0, edit widget:text edit. </div><div style=""><br></div><div style="">The SIGNAL is emitted when the first feature has a NULL value for id field. It happens only the first time I click on Toggle Edit Mode (after the attribute table is open), the second time I start an edit session from the same attribute table window, the SIGNAL is not emitted. To get the SIGNAL emitted once more, I just need to close the attribute table window and open it again, then starting an edit session emits the SIGNAL again.</div><div style=""><br></div><div style="">What you say about edit widgets makes sense, what I'd like to discuss is whether the SIGNAL should be emitted in such cases.</div><div style=""><br></div><div style=""><br></div><div style="">Regards,</div><div style=""><br></div><div style="">Germán </div><div style=""><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-07-13 1:12 GMT-05:00 Matthias Kuhn <span dir="ltr"><<a href="mailto:matthias@opengis.ch" target="_blank">matthias@opengis.ch</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div 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<div><div class="h5"><br>
<br>
<div>On 13/07/16 00:33, Germán Carrillo
wrote:<br>
</div>
</div></div><blockquote type="cite"><div><div class="h5">
<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 href="http://downloads.tuxfamily.org/tuxgis/tmp/test.zip" target="_blank">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 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 href="http://geotux.tuxfamily.org/" target="_blank">http://geotux.tuxfamily.org/</a><br>
<a href="http://twitter.com/GeoTux2" target="_blank">http://twitter.com/GeoTux2</a></div>
<div><a href="http://about.me/germancarrillo" target="_blank">http://about.me/germancarrillo</a><br>
</div>
<div>
<div><br>
</div>
<div><a href="http://gis.stackexchange.com/users/4972/germ%c3%a1n-carrillo" target="_blank"><img src="http://gis.stackexchange.com/users/flair/4972.png"></a></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
</div></div><pre>_______________________________________________
Qgis-developer mailing list
<a href="mailto:Qgis-developer@lists.osgeo.org" target="_blank">Qgis-developer@lists.osgeo.org</a>
List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a></pre>
</blockquote>
<br>
</div>
<br>_______________________________________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br></blockquote></div><br><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 href="http://geotux.tuxfamily.org/" target="_blank">http://geotux.tuxfamily.org/</a><br><a href="http://twitter.com/GeoTux2" target="_blank">http://twitter.com/GeoTux2</a></div><div><a href="http://about.me/germancarrillo" target="_blank">http://about.me/germancarrillo</a><br></div><div><div><br></div><div><a href="http://gis.stackexchange.com/users/4972/germ%c3%a1n-carrillo" target="_blank"><img src="http://gis.stackexchange.com/users/flair/4972.png"></a></div></div></div></div></div></div></div>
</div>