Skip to content
Permalink
Browse files
Fix #4439
  • Loading branch information
wonder-sk authored and mach0 committed Nov 13, 2011
1 parent 49ebe67 commit 61dfe66a15864b520e48806793abf4d042b2d167
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/app/legend/qgslegend.cpp
@@ -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() )
@@ -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 )
{

0 comments on commit 61dfe66

Please sign in to comment.