<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p>Hi Matthias,</p>
<p>Do you mean disabling them with a Python init code and QgsWidget.setEnabled(False) - right?</p>
<p>Just tried it - and it seems to work ;-)</p>
<p>Thanks for the hint!</p>
<p>Andreas</p>
<p id="reply-intro">On 2022-11-07 15:46, Matthias Kuhn wrote:</p>
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0">
<div id="replybody1">
<div>
<div dir="ltr">Hi Andreas,
<div> </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> </div>
<div>Matthias</div>
</div>
<br />
<div class="v1gmail_quote">
<div class="v1gmail_attr" dir="ltr">On Mon, Nov 7, 2022 at 3:42 PM Andreas Neumann via QGIS-Developer <<a href="mailto:qgis-developer@lists.osgeo.org" rel="noreferrer">qgis-developer@lists.osgeo.org</a>> wrote:</div>
<blockquote class="v1gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid #cccccc; 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" rel="noreferrer">QGIS-Developer@lists.osgeo.org</a><br />List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank" rel="noopener noreferrer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br />Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank" rel="noopener noreferrer">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a></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" rel="noopener noreferrer"><img src="cid:1667834322636921d257993152486287@carto.net" 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" rel="noopener noreferrer">Award for QField</a><span style="font-family: Roboto,RobotoDraft,Helvetica,Arial,sans-serif;"><span style="font-size: medium;"> </span></span>- Hold the power of QGIS in your hand</span><span style="font-family: Arial;"> - <a href="https://qfield.org/get" target="_blank" rel="noopener noreferrer">get it now</a><br /></span></div>
</div>
</div>
</blockquote>
<p><br /></p>

</body></html>