Skip to content

Commit 8c401d3

Browse files
author
mhugent
committed
Fix for canvas item order in print composer (ticket #2755)
git-svn-id: http://svn.osgeo.org/qgis/trunk@13633 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 8ff807c commit 8c401d3

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/core/composer/qgscomposermap.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,16 +1411,21 @@ void QgsComposerMap::drawCanvasItems( QPainter* painter, const QStyleOptionGraph
14111411
}
14121412

14131413
QList<QGraphicsItem*> itemList = mMapCanvas->items();
1414+
if ( itemList.size() < 1 )
1415+
{
1416+
return;
1417+
}
14141418

1415-
QList<QGraphicsItem*>::iterator itemIt = itemList.begin();
1416-
for ( ; itemIt != itemList.end(); ++itemIt )
1419+
QGraphicsItem* currentItem = 0;
1420+
for ( int i = itemList.size() - 1; i >= 0; --i )
14171421
{
1422+
currentItem = itemList.at( i );
14181423
//don't draw mapcanvasmap (has z value -10)
1419-
if ( !( *itemIt ) || ( *itemIt )->zValue() == -10 )
1424+
if ( !currentItem || currentItem->zValue() == -10 )
14201425
{
14211426
continue;
14221427
}
1423-
drawCanvasItem( *itemIt, painter, itemStyle );
1428+
drawCanvasItem( currentItem, painter, itemStyle );
14241429
}
14251430
}
14261431

0 commit comments

Comments
 (0)