Conversation
| elif dic["mode"] == 'clicking': | ||
| if dic['type'] == 'scatter': | ||
| self.layer_combo.currentLayer().selectByIds([dic['fidd']]) | ||
| exp = """ {} = '{}' """.format(dic['field'], dic['id']) |
There was a problem hiding this comment.
Strange, I can't do code suggestion ...
exp = QgsExpression.createFieldEqualityExpression(dic['field'], dic['id'])
self.layer_combo.currentLayer().selectByExpression(exp)This function createFieldEqualityExpression will manage if dic['id'] is integer or string for instance instance. I'm don't know what is the value
It's possible to make a selection straight from a expression string
There was a problem hiding this comment.
mmmm.. ok then we can stick with this patch. What do you think?
There was a problem hiding this comment.
Why do you want to stick to the current patch ?
You can make your code easier :
L484, L486 and L495 by using selectByExpression instead of selectByIds and having to create a loop.
getFeatures is not very efficient, even if you use a QgsFeatureRequest if you don't specify just the fields you need (ID in your example). You can read the blogpost https://nyalldawson.net/2016/10/speeding-up-your-pyqgis-scripts/
|
closing this PR because it's a little bit messy with the commits. See #293 |
Fix the selection behavior for scatterplots using the same js expression and qgsexpression as the other plot types.
We had problems with NULL values: js gave different id for the same feature(s) AND we have some problems when a feature subset was created.
@Gustry do you mind having a quick quick look at the js part?