This question is very related to the unanswered Retrieve features from QgsFieldExpressionWidget pyqgis
I have a layer and I've build a
QgsExpression that involves a field of that layer. What I'm trying to do is to evaluate the expression and get the results as a single list.
Just to have an example:
vl = iface.activeLayer() exp = QgsExpression('PH > 7') # where PH is the name of a field exp.prepare(vl.pendingFields()) # then I get this error Traceback (most recent call last): File "/usr/lib/python3.5/code.py", line 91, in runcode exec(code, self.locals) File "<input>", line 1, in <module> TypeError: QgsExpression.prepare(): argument 1 has unexpected type 'QgsFields'
Someone has already successfully used the
QgsExpression for QGIS master?