[Qgis-developer] Retrieving a print composer knowing its name, in Python

DelazJ delazj at gmail.com
Tue Jul 14 07:53:47 PDT 2015


Hi,
No idea?
Looking the composer manager code[0], it seems that any action, such as
deleting, duplicating or renaming a print composer, is processed through
interating over all print composers. No direct access. Am I right?
Is there no other way? An equivalent of mapLayersByName ?
If not, since print composers have now unique name, this will be a good
improvement, IMO.

[0]
https://github.com/qgis/QGIS/blob/master/src/app/composer/qgscomposermanager.cpp

Thanks,
DelazJ

2015-07-05 13:23 GMT+02:00 DelazJ <delazj at gmail.com>:

> Hi,
> I have many print composers in a project and would like to select one of
> them, knowing its name. The only way I found yet is to iterate over all
> composer views :
> for cView in iface.activeComposers():
>   if cView.composerWindow().windowTitle() == 'myTitle':
>      # do what I want
>
> Is this the only way to do it? Isn't there a more direct way to access
> print composer?
>
> Thanks,
> DelazJ
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20150714/a5e11d52/attachment.html>


More information about the Qgis-developer mailing list