Skip to content

Commit 58c34ae

Browse files
committed
[composer] Default to setting a map for new legend items
It's friendlier for users, who may not realise they need to set a map before they can filter legends.
1 parent 2b36dea commit 58c34ae

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/gui/qgscomposerview.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,11 @@ void QgsComposerView::mouseReleaseEvent( QMouseEvent* e )
845845
else
846846
{
847847
QgsComposerLegend* newLegend = new QgsComposerLegend( composition() );
848+
QList<const QgsComposerMap*> mapItemList = composition()->composerMapItems();
849+
if ( mapItemList.size() > 0 )
850+
{
851+
newLegend->setComposerMap( mapItemList.at( 0 ) );
852+
}
848853
newLegend->setSceneRect( QRectF( mRubberBandItem->transform().dx(), mRubberBandItem->transform().dy(), mRubberBandItem->rect().width(), mRubberBandItem->rect().height() ) );
849854
composition()->addComposerLegend( newLegend );
850855
newLegend->updateLegend();

0 commit comments

Comments
 (0)