<div dir="ltr">Hi Andreas,<div><br></div><div>How about going the other way around and leaving them as editable in the config and disabling the widget via python instead?</div><div><br></div><div>Matthias</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Nov 7, 2022 at 3:42 PM Andreas Neumann via QGIS-Developer <<a href="mailto:qgis-developer@lists.osgeo.org">qgis-developer@lists.osgeo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="font-size:10pt;font-family:Verdana,Geneva,sans-serif">
<p>Hi,</p>
<p>I have a QGIS form with a number of widgets that are set to "disabled". I don't want the user to change these values manually, but they should be updated by a Python action "on demand". Hence I set the editable state of these widgets to False.</p>
<p>Now I noticed that while I can change values in the widgets with my Python action, the values are not stored when the editable state is set to "False". As soon as I set the editable state to "True", then my Python action works fine and the values are correctly stored.</p>
<p>I tried with two approaches:</p>
<p>QgsAttributeForm.changeAttribute()</p>
<p>and</p>
<p>QgsWidget.setValue()</p>
<p>Both of these work fine when editable state is enabled, but not, when they are disabled.</p>
<p>Is there any way to also change attribute values when the editable state of a widget is set to False?</p>
<p>Thanks,</p>
<p>Andreas</p>

</div>
_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote></div>

<br>
<div style="text-align:left"><span style="font-family:Arial"><a href="https://www.opengis.ch/2022/11/03/best-of-swiss-enterprise-app-award-for-qfield/" target="_blank"><img src="https://www.opengis.ch/wp-content/uploads/2022/11/Mail-Footer_OpenGIS_393x120_AppAward.png" alt="https://www.opengis.ch/2022/11/03/best-of-swiss-enterprise-app-award-for-qfield/"></a><br></span></div><div style="text-align:left"><span style="font-family:Arial">Best of Swiss Enterprise App-<a href="https://www.opengis.ch/2022/11/03/best-of-swiss-enterprise-app-award-for-qfield/" target="_blank">Award for QField</a><span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif"><font size="3"> </font></span>- Hold the power of QGIS in your hand</span><span style="font-family:Arial"> - <a href="https://qfield.org/get" target="_blank">get it now</a><br></span></div>