Skip to content

Commit

Permalink
Avoid unnecessary canvas refreshes when adding group to legend
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Jun 9, 2011
1 parent 09878e5 commit f562810
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/app/legend/qgslegend.cpp
Expand Up @@ -156,6 +156,9 @@ int QgsLegend::addGroupToCurrentItem( QString name, bool expand )

int QgsLegend::addGroup( QString name, bool expand, QTreeWidgetItem* parent )
{
//avoid multiple refreshes of map canvas because of itemChanged signal
blockSignals( true );

bool nameEmpty = name.isEmpty();
if ( nameEmpty )
name = tr( "group" ); // some default name if none specified
Expand All @@ -174,6 +177,7 @@ int QgsLegend::addGroup( QString name, bool expand, QTreeWidgetItem* parent )
if ( nameEmpty )
openEditor();

blockSignals( false );
return groupIndex.row();
}

Expand Down

0 comments on commit f562810

Please sign in to comment.