Re: [QGIS-Developer] Adding Map layer to current project destroy custom layer variables in Qgis3

2018-06-21 Thread David Marteau
Hi, Yes, that's the point. I was surprised by the fact that those variables where stored as part of the exported qml file. I was trying to set those variable in processing algorithm so that I could achieve some parametrization of the style associated with the processing output, but no luck

Re: [QGIS-Developer] Adding Map layer to current project destroy custom layer variables in Qgis3

2018-06-21 Thread Matthias Kuhn
Hi David, Variables are a part of QML / Layer Style. There is a QEP open about handling of this: https://github.com/qgis/QGIS-Enhancement-Proposals/issues/125 While variables are not explicitly mentioned in there, it would be good to treat them in the same way. I.e. allow exporting and

Re: [QGIS-Developer] Adding Map layer to current project destroy custom layer variables in Qgis3

2018-06-21 Thread Richard Duivenvoorde
Hi David, this sounds like a bug, so I would say: create an issue with clear steps so others can reproduce/fix BUT I cannot reproduce. Doing your steps I see 'FOO' is just saved in the project file (and viewable after unzipping the qgz file) And even after loading the qml and restartnig

Re: [QGIS-Developer] Adding Map layer to current project destroy custom layer variables in Qgis3

2018-06-20 Thread David Marteau
Just found out that this is not addMapLayer that remove the variables but 'layer.loadNamedStyle' Print layer.customProperty('variableNames') just before calling 'layer.loadNamedStyle' show variables Print layer.customProperty('variableNames') just after the call : empty list Reproduced in

[QGIS-Developer] Adding Map layer to current project destroy custom layer variables in Qgis3

2018-06-20 Thread David Marteau
Hi I'm trying to set custom layers variables from processing using QgsExpressionContextUtils.setLayerVariables to destination layers , I have found that those variables does not appear in Qgis. I have found that when the layer is inserted in the current project