Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix wrong extent after loading project files with embedded groups
  • Loading branch information
mhugent committed Mar 7, 2012
1 parent 6e20c54 commit e71494a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/app/legend/qgslegend.cpp
Expand Up @@ -1319,6 +1319,12 @@ bool QgsLegend::writeXML( QList<QTreeWidgetItem *> items, QDomNode &node, QDomDo

bool QgsLegend::readXML( QgsLegendGroup *parent, const QDomNode &node )
{
QgsRectangle bkMapExtent;
if ( mMapCanvas )
{
bkMapExtent = mMapCanvas->extent();
}

const QDomNodeList &l = node.childNodes();
for ( int i = 0; i < l.count(); i++ )
{
Expand Down Expand Up @@ -1444,6 +1450,11 @@ bool QgsLegend::readXML( QgsLegendGroup *parent, const QDomNode &node )
}
}

//restore canvas extent (could be changed by addLayer calls)
if ( !bkMapExtent.isEmpty() )
{
mMapCanvas->setExtent( bkMapExtent );
}
return true;
}

Expand Down

0 comments on commit e71494a

Please sign in to comment.