I am updating some plugins which use QgsExpression, and I'm wondering about the 
best way to use expressions in QGIS3.  It in the past I used a pattern like:

  exp=QgsExpression(expressionText)
  exp.prepare(fields)
  request=QgsFeatureRequest()
  request.setSubsetOfAttributes( expression.referencedColumns(), fields )
  for feat in layer.getFeatures(request)
      value=expression.evaluate(feat)

However with QGIS3 this has clearly changed!  QgsExpression is not included in 
the QGIS3 API https://qgis.org/api/annotated.html.  The prepare and 
referencedColumns are no longer defined. I did have a look at the C++ code for 
QgsExpression, but I find I'm still looking for guidance.

I've searched the QEP issues  been able to locate a QEP, or other 
documentation.  Can anyone point me to some documentation or provide an example 
of current best practice please.

________________________________

This message contains information, which may be in confidence and may be 
subject to legal privilege. If you are not the intended recipient, you must not 
peruse, use, disseminate, distribute or copy this message. If you have received 
this message in error, please notify us immediately (Phone 0800 665 463 or 
[email protected]) and destroy the original message. LINZ accepts no 
responsibility for changes to this email, or for any attachments, after its 
transmission from LINZ. Thank You.
_______________________________________________
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

Reply via email to