mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Fix for ticket #72
git-svn-id: http://svn.osgeo.org/qgis/trunk@5273 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
21a92b5fa9
commit
4109517233
@ -37,6 +37,7 @@
|
|||||||
#include "qgsproject.h"
|
#include "qgsproject.h"
|
||||||
#include "qgssymbol.h"
|
#include "qgssymbol.h"
|
||||||
#include "qgsmaplayer.h"
|
#include "qgsmaplayer.h"
|
||||||
|
#include "qgslegend.h"
|
||||||
#include "qgslegendlayerfile.h"
|
#include "qgslegendlayerfile.h"
|
||||||
|
|
||||||
|
|
||||||
@ -105,6 +106,9 @@ void QgsMapLayer::setLayerName(const QString & _newVal)
|
|||||||
{
|
{
|
||||||
QgsDebugMsg("QgsMapLayer::setLayerName: new name is '" + _newVal);
|
QgsDebugMsg("QgsMapLayer::setLayerName: new name is '" + _newVal);
|
||||||
layerName = _newVal;
|
layerName = _newVal;
|
||||||
|
// And update the legend if one exists
|
||||||
|
if (mLegend)
|
||||||
|
mLegend->setName(mLegendLayerFile, layerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Read property of QString layerName. */
|
/** Read property of QString layerName. */
|
||||||
|
@ -1281,6 +1281,22 @@ void QgsLegend::changeSymbologySettings(const QString& key, const std::list< std
|
|||||||
setCurrentItem(theCurrentItem);
|
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)
|
void QgsLegend::handleItemChange(QTreeWidgetItem* item, int row)
|
||||||
{
|
{
|
||||||
if(!item)
|
if(!item)
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
class QgisApp;
|
class QgisApp;
|
||||||
class QgsLegendLayer;
|
class QgsLegendLayer;
|
||||||
|
class QgsLegendLayerFile;
|
||||||
class QgsLegendItem;
|
class QgsLegendItem;
|
||||||
class QgsMapLayer;
|
class QgsMapLayer;
|
||||||
class QgsMapCanvas;
|
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*/
|
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);
|
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:
|
public slots:
|
||||||
|
|
||||||
/*!Adds a new layer group with the maplayer to the canvas*/
|
/*!Adds a new layer group with the maplayer to the canvas*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user