[QGIS-Developer] PyQGIS code: setting filter expression for value relation widget
Andreas Neumann
a.neumann at carto.net
Mon Feb 13 02:44:56 PST 2023
Hi,
I found the "QgsValueRelationSearchWidgetWrapper" class, which seems to
have a "setExpression" method - but I don't know how I can access and
change the QgsValueRelationSearchWidgetWrapper of an existing ComboBox
in the attribute form.
Andreas
On 2023-02-13 11:31, Andreas Neumann via QGIS-Developer wrote:
> Hi,
>
> I am looking for a code snippet in PyQGIS: how can I change the filter
> expression for a value relation widget?
>
> Technically, the widget seems to be a QComboBox. I can get access to
> the combobox, e.g. to get the current value - but how can I access the
> QGIS related functionality, like changing programmatically settings of
> the value relation widget , such as the filter expression? I found the
> QgsValueRelationFieldFormatter object, but it doesn't allow me to
> change the filter expression. Any idea how I would change the filter
> expression using Python?
>
> Thank you for any hints,
>
> Andreas
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20230213/695b7fd2/attachment.htm>
More information about the QGIS-Developer
mailing list