Skip to content
Permalink
Browse files

Fix LayerTreeModel use of beginInsertRows with embedded legends

  • Loading branch information
Sandro Santilli
Sandro Santilli committed Dec 23, 2014
1 parent a4aaff5 commit 32079ed3cf7cf851515c63ed01cb994169f45963
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/core/layertree/qgslayertreemodel.cpp
@@ -794,7 +794,9 @@ void QgsLayerTreeModel::addLegendToLayer( QgsLayerTreeLayer* nodeL )

QList<QgsLayerTreeModelLegendNode*> filteredLstNew = filterLegendNodes( lstNew );

beginInsertRows( node2index( nodeL ), 0, filteredLstNew.count() - 1 );
bool isEmbedded = filteredLstNew.count() == 1 && filteredLstNew[0]->isEmbeddedInParent();

if ( ! isEmbedded ) beginInsertRows( node2index( nodeL ), 0, filteredLstNew.count() - 1 );

foreach ( QgsLayerTreeModelLegendNode* n, lstNew )
{
@@ -805,7 +807,7 @@ void QgsLayerTreeModel::addLegendToLayer( QgsLayerTreeLayer* nodeL )
mOriginalLegendNodes[nodeL] = lstNew;
mLegendNodes[nodeL] = filteredLstNew;

endInsertRows();
if ( ! isEmbedded ) endInsertRows();
}


0 comments on commit 32079ed

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