Skip to content
Permalink
Browse files

Respect the overridden layer name in composer legend also in rendered…

… legend
  • Loading branch information
wonder-sk committed Sep 5, 2014
1 parent 36467e9 commit e2f1ceb741960635a51d38f0b65bd87c52f15cef
@@ -745,6 +745,11 @@ void QgsComposerLegendWidget::on_mEditPushButton_clicked()
else if ( QgsLayerTree::isLayer( currentNode ) )
{
currentNode->setCustomProperty( "legend/title-label", newText );

// force update of label of the legend node with embedded icon (a bit clumsy i know)
QList<QgsLayerTreeModelLegendNode*> nodes = model->layerLegendNodes( QgsLayerTree::toLayer( currentNode ) );
if ( nodes.count() == 1 && nodes[0]->isEmbeddedInParent() )
nodes[0]->setUserLabel( QString() );
}
else if ( legendNode )
{
@@ -305,7 +305,11 @@ void QgsSymbolV2LegendNode::updateLabel()

if ( mEmbeddedInParent )
{
mLabel = mUserLabel.isEmpty() ? mLayerNode->layerName() : mUserLabel;
QString layerName = mLayerNode->layerName();
if ( !mLayerNode->customProperty( "legend/title-label" ).isNull() )
layerName = mLayerNode->customProperty( "legend/title-label" ).toString();

mLabel = mUserLabel.isEmpty() ? layerName : mUserLabel;
if ( showFeatureCount && vl && vl->pendingFeatureCount() >= 0 )
mLabel += QString( " [%1]" ).arg( vl->pendingFeatureCount() );
}

0 comments on commit e2f1ceb

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