Skip to content
Permalink
Browse files

Fix for ticket #72

git-svn-id: http://svn.osgeo.org/qgis/trunk@5273 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m
g_j_m committed Apr 13, 2006
1 parent 21a92b5 commit 410951723388521986092ada6cefd72c9e0e43e6
Showing with 25 additions and 0 deletions.
  1. +4 −0 src/gui/qgsmaplayer.cpp
  2. +16 −0 src/legend/qgslegend.cpp
  3. +5 −0 src/legend/qgslegend.h
@@ -37,6 +37,7 @@
#include "qgsproject.h"
#include "qgssymbol.h"
#include "qgsmaplayer.h"
#include "qgslegend.h"
#include "qgslegendlayerfile.h"


@@ -105,6 +106,9 @@ void QgsMapLayer::setLayerName(const QString & _newVal)
{
QgsDebugMsg("QgsMapLayer::setLayerName: new name is '" + _newVal);
layerName = _newVal;
// And update the legend if one exists
if (mLegend)
mLegend->setName(mLegendLayerFile, layerName);
}

/** Read property of QString layerName. */
@@ -1281,6 +1281,22 @@ void QgsLegend::changeSymbologySettings(const QString& key, const std::list< std
setCurrentItem(theCurrentItem);
}

void QgsLegend::setName(QgsLegendLayerFile* legendLayerFile,
QString layerName)
{
if (legendLayerFile)
{
QTreeWidgetItem* p = legendLayerFile->parent();
if (p)
{
p = p->parent();
if (p)
p->setText(0, layerName);
}
}

}

void QgsLegend::handleItemChange(QTreeWidgetItem* item, int row)
{
if(!item)
@@ -26,6 +26,7 @@

class QgisApp;
class QgsLegendLayer;
class QgsLegendLayerFile;
class QgsLegendItem;
class QgsMapLayer;
class QgsMapCanvas;
@@ -145,6 +146,10 @@ class QgsLegend : public QTreeWidget
Note: the QIcon* are deleted and therefore need to be allocated by calling functions using operator new*/
void changeSymbologySettings(const QString& key, const std::list< std::pair<QString, QIcon*> >* newSymbologyItems);

/** Sets the name of the QgsLegendLayer that is the parent of
the given QgsLegendLayerFile */
void setName(QgsLegendLayerFile* w, QString layerName);

public slots:

/*!Adds a new layer group with the maplayer to the canvas*/

0 comments on commit 4109517

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