Skip to content
Permalink
Browse files

Fix multiple empty layouts created when reloading project

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 56332b33c427c695c0f5d560993c40a67873d643
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/core/composer/qgslayoutmanager.cpp
@@ -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 ) )

0 comments on commit 56332b3

Please sign in to comment.
You can’t perform that action at this time.