Skip to content

Commit

Permalink
[composer] Default to setting a map for new legend items
Browse files Browse the repository at this point in the history
It's friendlier for users, who may not realise they need to set
a map before they can filter legends.
  • Loading branch information
nyalldawson committed Oct 21, 2014
1 parent 2b36dea commit 58c34ae
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/gui/qgscomposerview.cpp
Expand Up @@ -845,6 +845,11 @@ void QgsComposerView::mouseReleaseEvent( QMouseEvent* e )
else
{
QgsComposerLegend* newLegend = new QgsComposerLegend( composition() );
QList<const QgsComposerMap*> mapItemList = composition()->composerMapItems();
if ( mapItemList.size() > 0 )
{
newLegend->setComposerMap( mapItemList.at( 0 ) );
}
newLegend->setSceneRect( QRectF( mRubberBandItem->transform().dx(), mRubberBandItem->transform().dy(), mRubberBandItem->rect().width(), mRubberBandItem->rect().height() ) );
composition()->addComposerLegend( newLegend );
newLegend->updateLegend();
Expand Down

0 comments on commit 58c34ae

Please sign in to comment.