Skip to content

Commit

Permalink
Fix multiple empty layouts created when reloading project
Browse files Browse the repository at this point in the history
In related news... I find it frustrating that there's no
way in Qt to restrict elementsByTagName to direct descendants
only, and that all other available API calls for searching
only direct descendants are much more fiddly...
  • Loading branch information
nyalldawson committed Jan 5, 2018
1 parent dcf364f commit 56332b3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/composer/qgslayoutmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,12 @@ bool QgsLayoutManager::readXml( const QDomElement &element, const QDomDocument &
context.setPathResolver( mProject->pathResolver() );

// restore layouts
const QDomNodeList layoutNodes = element.elementsByTagName( QStringLiteral( "Layout" ) );
const QDomNodeList layoutNodes = layoutsElem.childNodes();
for ( int i = 0; i < layoutNodes.size(); ++i )
{
if ( layoutNodes.at( i ).nodeName() != QStringLiteral( "Layout" ) )
continue;

std::unique_ptr< QgsPrintLayout > l = qgis::make_unique< QgsPrintLayout >( mProject );
l->undoStack()->blockCommands( true );
if ( !l->readLayoutXml( layoutNodes.at( i ).toElement(), doc, context ) )
Expand Down

0 comments on commit 56332b3

Please sign in to comment.