Skip to content

Commit f082966

Browse files
author
morb_au
committed
When loading a project file, restore the canvas extent to that provided in the project file (i.e. the extent in existence when the project file was saved). Previously the extent was the maximum extent across all layers.
I'm not sure why this functionality hasn't been done before, as it seemed so trivial to implement? The main benefit to its implementation is that in large layers, the user doesn't have to wait for the whole layer to draw before he can restart work on a project (which is particularly important since we currently can no longer hit Esc to halt a redraw). git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5613 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent a165cb6 commit f082966

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/gui/qgsproject.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,8 @@ bool QgsProject::read()
10981098
// get the map layers
10991099
pair< bool, list<QDomNode> > getMapLayersResults = _getMapLayers(*doc);
11001100

1101+
// Restore the map canvas extent
1102+
11011103
QgsRect savedExtent;
11021104

11031105
if (!_getExtents(*doc, savedExtent))
@@ -1114,6 +1116,15 @@ bool QgsProject::read()
11141116

11151117
// return false;
11161118
}
1119+
else
1120+
{
1121+
if (canvas)
1122+
{
1123+
canvas->setExtent(savedExtent);
1124+
}
1125+
}
1126+
1127+
// review the integrity of the retrieved map layers
11171128

11181129
if ( ! getMapLayersResults.first )
11191130
{

0 commit comments

Comments
 (0)