Skip to content
Permalink
Browse files

Fix #4439

  • Loading branch information
wonder-sk committed Oct 31, 2011
1 parent dd03451 commit ed20ff368723695a76c03648b7b528b4bf827adb
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/app/legend/qgslegend.cpp
@@ -1752,7 +1752,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() )
@@ -1763,7 +1768,7 @@ void QgsLegend::refreshLayerSymbology( QString key, bool expandItem )
theLegendLayer->refreshSymbology( key, widthScale );

//restore the current item again
setCurrentIndex( currentItemIndex );
setCurrentItem( current );
adjustIconSize();
setItemExpanded( theLegendLayer, expandItem );//make sure the symbology items are visible
}

0 comments on commit ed20ff3

Please sign in to comment.
You can’t perform that action at this time.