Skip to content

Commit 2e85c73

Browse files
author
mhugent
committed
Fix for bug #600 Renaming layer in legend doesn't stick
git-svn-id: http://svn.osgeo.org/qgis/trunk@6615 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent d68b82e commit 2e85c73

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/app/legend/qgslegend.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -1456,6 +1456,16 @@ void QgsLegend::handleItemChange(QTreeWidgetItem* item, int row)
14561456
}
14571457

14581458
closePersistentEditor(item, row);
1459+
//if the text of a QgsLegendLayer has changed, change the display names of all its maplayers
1460+
QgsLegendLayer* theLegendLayer = dynamic_cast<QgsLegendLayer*>(item); //item is a legend layer
1461+
if(theLegendLayer)
1462+
{
1463+
std::list<QgsMapLayer*> theMapLayers = theLegendLayer->mapLayers();
1464+
for(std::list<QgsMapLayer*>::iterator it = theMapLayers.begin(); it != theMapLayers.end(); ++it)
1465+
{
1466+
(*it)->setLayerName(theLegendLayer->text(0));
1467+
}
1468+
}
14591469

14601470
std::map<QTreeWidgetItem*, Qt::CheckState>::iterator it = mStateOfCheckBoxes.find(item);
14611471
if (it == mStateOfCheckBoxes.end())

0 commit comments

Comments
 (0)