mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
fix QgsLayerTreeModel::refreshLayerLegend (#9785)
* fix QgsLayerTreeModel::refreshLayerLegend Guard if the QModelIndex (idx) has no children. * Update qgslayertreemodel.cpp * Update qgslayertreemodel.cpp * Update qgslayertreemodel.cpp * Apply suggestions from code review Co-Authored-By: vcloarec <vcloarec@gmail.com>
This commit is contained in:
parent
891ea18bab
commit
bed3da4308
@ -539,9 +539,12 @@ void QgsLayerTreeModel::refreshLayerLegend( QgsLayerTreeLayer *nodeLayer )
|
||||
|
||||
// update children
|
||||
int oldNodeCount = rowCount( idx );
|
||||
beginRemoveRows( idx, 0, std::max( oldNodeCount - 1, 0 ) );
|
||||
removeLegendFromLayer( nodeLayer );
|
||||
endRemoveRows();
|
||||
if ( oldNodeCount > 0 )
|
||||
{
|
||||
beginRemoveRows( idx, 0, oldNodeCount - 1 );
|
||||
removeLegendFromLayer( nodeLayer );
|
||||
endRemoveRows();
|
||||
}
|
||||
|
||||
addLegendToLayer( nodeLayer );
|
||||
int newNodeCount = rowCount( idx );
|
||||
|
Loading…
x
Reference in New Issue
Block a user