Fix model's signals if no symbology nodes are added

This commit is contained in:
Martin Dobias 2014-06-18 20:26:38 +07:00
parent 045695a0b0
commit 092265b9ed

View File

@ -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;
@ -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 );
@ -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;