Hi Andreas, How about going the other way around and leaving them as editable in the config and disabling the widget via python instead?
Matthias On Mon, Nov 7, 2022 at 3:42 PM Andreas Neumann via QGIS-Developer < qgis-developer@lists.osgeo.org> wrote: > Hi, > > 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. > > 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. > > I tried with two approaches: > > QgsAttributeForm.changeAttribute() > > and > > QgsWidget.setValue() > > Both of these work fine when editable state is enabled, but not, when they > are disabled. > > Is there any way to also change attribute values when the editable state > of a widget is set to False? > > Thanks, > > Andreas > _______________________________________________ > QGIS-Developer mailing list > QGIS-Developer@lists.osgeo.org > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer > -- <https://www.opengis.ch/2022/11/03/best-of-swiss-enterprise-app-award-for-qfield/> Best of Swiss Enterprise App-Award for QField <https://www.opengis.ch/2022/11/03/best-of-swiss-enterprise-app-award-for-qfield/> - Hold the power of QGIS in your hand - get it now <https://qfield.org/get>
_______________________________________________ QGIS-Developer mailing list QGIS-Developer@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer