On 8 February 2018 at 08:10, Marc Ducobu <[email protected]> wrote:
> > With QgsComposition, it was possible to pass a "substitution map" to the > method loadFromTemplate : the substitution map was a map/associative > array such that when loading the template, strings like "[key]" were > replaced by the value associated to the key ( see > https://qgis.org/api/2.18/qgscomposition_8cpp_source.html#l01107 ). > > With QgsLayout, I have the impression that this feature has disappear. > Do you know if it exists an alternative way to obtain an equivalent result ? > > Thanks a lot. Yes - I removed that argument as it was unused in the code and looked like a legacy leftover. My thoughts are that these substitutions would be better performed now by placing expressions and through use of expression variables directly inside the layout elements themselves - e.g. instead of using the substitution to replace a label's text, put an expression directly inside the label text and use the built in expression functions or variables to evaluate to the desired text. Alternatively, given that the argument was API only and not exposed to users anywhere, it could also be done directly using built in python replace methods prior to calling loadFromTemplate. 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
