Skip to content
Permalink
Browse files
Fix wrong extent after loading project files with embedded groups
  • Loading branch information
mhugent committed Mar 7, 2012
1 parent 6e20c54 commit e71494a5607b5c9792415e3652c5b8797d1f5e73
Showing with 11 additions and 0 deletions.
  1. +11 −0 src/app/legend/qgslegend.cpp
@@ -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++ )
{
@@ -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;
}

0 comments on commit e71494a

Please sign in to comment.