Skip to content

Commit

Permalink
composer legend feature counts add only to multi symbol or labeled si…
Browse files Browse the repository at this point in the history
…ngle symbols
  • Loading branch information
blazek committed Mar 20, 2013
1 parent 981c174 commit 7008cd4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/core/composer/qgslegendmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,12 @@ int QgsLegendModel::addVectorLayerItemsV2( QStandardItem* layerItem, QgsVectorLa
QString label = symbolIt->first;
if ( lItem->showFeatureCount() )
{
label += QString( " [%1]" ).arg( vlayer->featureCount( symbolIt->second ) );
// Add counts to multi symbols layers only or labeled single symbols,
// so that single symbol layers are still drawn on single line
if ( lst.size() > 1 || !label.isEmpty() )
{
label += QString( " [%1]" ).arg( vlayer->featureCount( symbolIt->second ) );
}
}
QgsComposerSymbolV2Item* currentSymbolItem = new QgsComposerSymbolV2Item( label );
currentSymbolItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable );
Expand Down

0 comments on commit 7008cd4

Please sign in to comment.