Skip to content

Commit

Permalink
Fix #4439
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk authored and mach0 committed Nov 13, 2011
1 parent 49ebe67 commit 61dfe66
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/app/legend/qgslegend.cpp
Expand Up @@ -1564,7 +1564,12 @@ void QgsLegend::refreshLayerSymbology( QString key, bool expandItem )
}

//store the current item
QModelIndex currentItemIndex( currentIndex() );
QTreeWidgetItem* current = currentItem();
// in case the current item is a child of the layer, use the layer as current item
// because otherwise we would set an invalid item as current item
// (in refreshSymbology the symbology items are removed and new ones are added)
if ( current->parent() == theLegendLayer )
current = current->parent();

double widthScale = 1.0;
if ( mMapCanvas && mMapCanvas->map() )
Expand All @@ -1575,7 +1580,7 @@ void QgsLegend::refreshLayerSymbology( QString key, bool expandItem )
theLegendLayer->refreshSymbology( key, widthScale );

//restore the current item again
setCurrentIndex( currentItemIndex );
setCurrentItem( current );
adjustIconSize();
if ( expandItem )
{
Expand Down

0 comments on commit 61dfe66

Please sign in to comment.