[Qgis-developer] QgsComposer-cleanupAfterTemplateRead() not used: composer template NOT refreshing map item

Richard Duivenvoorde rdmailings at duif.net
Tue Jun 3 07:29:50 PDT 2014


Hi,

somebody asked me when using Composer templates in another project, the
map item should not be refreshed by default.

Currently if you create a composer template(!) in project A (centered
around Europe), and then want to use that template in project B
(centered aroudn North-America), you will not see North America when you
load the template in project B.
You have to do several actions:
- click on the MapItem
- click 'Set to map canvas extent'
- click 'update preview' (hoping you have the Render option active)

In the code I found a method: cleanupAfterTemplateRead()

https://github.com/qgis/QGIS/blob/master/src/app/composer/qgscomposer.cpp#L3249

If I call that method in the on_mActionLoadFromTemplate_triggered like this:
on_mActionLoadFromTemplate_triggered()
{
  loadTemplate( false );
  cleanupAfterTemplateRead();
}

the template shows up in the way we think is logical: showing you your
map which you are viewing in QGIS.

Question:
- is this removed by accident, or deliberate?
maybe the loading of the templates is changed after adding the atlas
functionality?

Question 2:
- am I the only one who does not like the wording/concepts around
composers and templates?

There are 'composers' and 'templates'?
If I save a composer, what I actually save is a QGIS project?
There are 3 menu-items all to open a new composer (always needing an
extra 'title' step)
etc

Isn't the trick that a composer is actually a 'print layout', and that
you either save that one in the project (now called a composer then) or
as a separate file (then called a template)?
Or is a 'composer' actually a print layer with fixed layers/extent etc etc?
Not sure if it is easy to make this more clear. Maybe some UI people
have an opinion?
Otherwise, just ignore this question :-)

Regards,

Richard Duivenvoorde


More information about the Qgis-developer mailing list