[QGIS-Developer] QgsLayout LoadFromTemplate & substitutionMap

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[QGIS-Developer] QgsLayout LoadFromTemplate & substitutionMap

Marc Ducobu-2
_______________________________________________
QGIS-Developer mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

attachment0 (12 bytes) Download Attachment
encrypted.asc (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: QgsLayout LoadFromTemplate & substitutionMap

Nyall Dawson
2018-02-08 0:22 GMT+10:00 Marc Ducobu <[hidden email]>:
> -----BEGIN PGP MESSAGE-----
>
> hQEMAwq3T6TpWbvPAQf+N5YzqrBzxjmEIwEjuodMGCOvUtoaxlzbt91dV7sWOxm9

> -----END PGP MESSAGE-----

Can you send a non-encoded version of this message please? The subject
looks interesting, but I can't read it.

Nyall
_______________________________________________
QGIS-Developer mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: QgsLayout LoadFromTemplate & substitutionMap

Marc Ducobu-2
Hello,

Sorry about that.

Here is the non-encoded version.

Marc

----


Hello,

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.

Marc




On 2018-02-07 22:53, Nyall Dawson wrote:
> 2018-02-08 0:22 GMT+10:00 Marc Ducobu <[hidden email]>:
>> -----BEGIN PGP MESSAGE-----
>>
>> hQEMAwq3T6TpWbvPAQf+N5YzqrBzxjmEIwEjuodMGCOvUtoaxlzbt91dV7sWOxm9
>> -----END PGP MESSAGE-----
> Can you send a non-encoded version of this message please? The subject
> looks interesting, but I can't read it.
>
> Nyall

_______________________________________________
QGIS-Developer mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: QgsLayout LoadFromTemplate & substitutionMap

Tim Sutton-6
Hi




On 08 Feb 2018, at 00:10, Marc Ducobu <[hidden email]> wrote:

Hello,

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 ?


Eish I hope we didn't lose it too ... we use this heavily….though I guess you could do similar things with variables and expressions now…

Regards

Tim


Thanks a lot.

Marc




On 2018-02-07 22:53, Nyall Dawson wrote:
2018-02-08 0:22 GMT+10:00 Marc Ducobu <[hidden email]>:
-----BEGIN PGP MESSAGE-----

hQEMAwq3T6TpWbvPAQf+N5YzqrBzxjmEIwEjuodMGCOvUtoaxlzbt91dV7sWOxm9
-----END PGP MESSAGE-----
Can you send a non-encoded version of this message please? The subject
looks interesting, but I can't read it.

Nyall

_______________________________________________
QGIS-Developer mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer







Tim Sutton

Co-founder: Kartoza
Project chair: QGIS.org

Visit http://kartoza.com to find out about open source:

Desktop GIS programming services
Geospatial web development
GIS Training
Consulting Services

Skype: timlinux 
IRC: timlinux on #qgis at freenode.net


_______________________________________________
QGIS-Developer mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

signature.asc (499 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: QgsLayout LoadFromTemplate & substitutionMap

Nyall Dawson
In reply to this post by Marc Ducobu-2
On 8 February 2018 at 08:10, Marc Ducobu <[hidden email]> 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
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer