Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Safer generation of ids for composer map
git-svn-id: http://svn.osgeo.org/qgis/trunk@15040 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jan 14, 2011
1 parent e0bf276 commit 2651a2d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/core/composer/qgscomposermap.cpp
Expand Up @@ -47,7 +47,20 @@ QgsComposerMap::QgsComposerMap( QgsComposition *composition, int x, int y, int w
mCrossLength( 3 ), mMapCanvas( 0 ), mDrawCanvasItems( true )
{
mComposition = composition;
mId = mComposition->composerMapItems().size();

//mId = mComposition->composerMapItems().size();
int maxId = -1;
QList<const QgsComposerMap*> mapList = mComposition->composerMapItems();
QList<const QgsComposerMap*>::const_iterator mapIt = mapList.constBegin();
for ( ; mapIt != mapList.constEnd(); ++mapIt )
{
if (( *mapIt )->id() > maxId )
{
maxId = ( *mapIt )->id();
}
}
mId = maxId + 1;

mMapRenderer = mComposition->mapRenderer();
mPreviewMode = QgsComposerMap::Rectangle;
mCurrentRectangle = rect();
Expand Down

0 comments on commit 2651a2d

Please sign in to comment.