Skip to content
Permalink
Browse files
Fix restoration of compositions from legacy projects
  • Loading branch information
nyalldawson committed Mar 21, 2017
1 parent 54d1a93 commit c9b87387fa9ebdc99d29e2e45c11b3c36aa025be
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/core/composer/qgslayoutmanager.cpp
@@ -102,19 +102,25 @@ bool QgsLayoutManager::readXml( const QDomElement &element, const QDomDocument &
layoutsElem = element.firstChildElement( QStringLiteral( "Layouts" ) );
}
if ( layoutsElem.isNull() )
return false;
{
// handle legacy projects
layoutsElem = doc.documentElement();
}

//restore each composer
bool result = true;
QDomNodeList composerNodes = element.elementsByTagName( QStringLiteral( "Composer" ) );
for ( int i = 0; i < composerNodes.size(); ++i )
{
QString legacyTitle = composerNodes.at( i ).toElement().attribute( QStringLiteral( "title" ) );
QgsComposition *c = createCompositionFromXml( composerNodes.at( i ).toElement(), doc );
if ( !c )
{
result = false;
continue;
}
if ( c->name().isEmpty() )
c->setName( legacyTitle );
result = result && addComposition( c );
}
return result;

0 comments on commit c9b8738

Please sign in to comment.