Skip to content

Commit

Permalink
Fix model's signals if no symbology nodes are added
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Jun 18, 2014
1 parent 045695a commit 092265b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/gui/layertree/qgslayertreemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,9 @@ void QgsLayerTreeModel::addSymbologyToVectorLayer( QgsLayerTreeLayer* nodeL )
QSize iconSize( 16, 16 );
QgsLegendSymbolList items = r->legendSymbolItems();

if ( items.count() == 0 )
return;

beginInsertRows( node2index( nodeL ), 0, items.count() - 1 );

typedef QPair<QString, QgsSymbolV2*> XY;
Expand Down Expand Up @@ -676,6 +679,9 @@ void QgsLayerTreeModel::addSymbologyToRasterLayer( QgsLayerTreeLayer* nodeL )
lst << new QgsLayerTreeModelSymbologyNode( nodeL, tr( "Double-click to view legend" ) );
}

if ( rasterItemList.count() == 0 )
return;

// Paletted raster may have many colors, for example UInt16 may have 65536 colors
// and it is very slow, so we limit max count
QSize iconSize( 16, 16 );
Expand Down Expand Up @@ -714,6 +720,9 @@ void QgsLayerTreeModel::addSymbologyToPluginLayer( QgsLayerTreeLayer* nodeL )
QSize iconSize( 16, 16 );
QgsLegendSymbologyList symbologyList = player->legendSymbologyItems( iconSize );

if ( symbologyList.count() == 0 )
return;

beginInsertRows( node2index( nodeL ), 0, symbologyList.count() - 1 );

typedef QPair<QString, QPixmap> XY;
Expand Down

0 comments on commit 092265b

Please sign in to comment.