On 26 June 2017 at 21:11, matteo <[email protected]> wrote: > Hi all, > > I'm writing a plugin that uses QgsFieldExpressionWidget to get the field > and its attributes from a layer. > > I'm really fighting to find a method to get the attributes of the field > as a list when an expression if typed.
In QGIS 3.0 QgsVectorLayer::getValues will do what you want in a single call: https://qgis.org/api/classQgsVectorLayer.html#ac8cfb12633ed536da73f42ebff095f99 That works for either a field: layer.getValues('my_field') or an expression: layer.getValues('my_field * 2') Nyall _______________________________________________ QGIS-Developer mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
