From bced26a4aacc284d78e8dedd14709e0b65a403f4 Mon Sep 17 00:00:00 2001 From: mhugent Date: Wed, 24 Oct 2007 07:23:24 +0000 Subject: [PATCH] Applied patch for legend refresh from plugins provided by Juergen git-svn-id: http://svn.osgeo.org/qgis/trunk@7296 c8812cc2-4d05-0410-92ff-de0c093fc19c --- python/gui/qgisinterface.sip | 3 +++ src/app/qgisappinterface.cpp | 8 ++++++++ src/app/qgisappinterface.h | 2 ++ src/gui/qgisinterface.h | 3 +++ 4 files changed, 16 insertions(+) diff --git a/python/gui/qgisinterface.sip b/python/gui/qgisinterface.sip index cc3f9c1fed0..b6c32b9a427 100644 --- a/python/gui/qgisinterface.sip +++ b/python/gui/qgisinterface.sip @@ -81,6 +81,9 @@ class QgisInterface : QObject /** Return a pointer to the toolbox (where additional pages can be inserted) */ virtual QToolBox* getToolBox()=0; + /** refresh legend of a layer */ + virtual void refreshLegend( QgsMapLayer * layer )=0; + signals: /** Emited whenever current (selected) layer changes. * The pointer to layer can be null if no layer is selected diff --git a/src/app/qgisappinterface.cpp b/src/app/qgisappinterface.cpp index 75276f46aac..b8790aa1d8c 100644 --- a/src/app/qgisappinterface.cpp +++ b/src/app/qgisappinterface.cpp @@ -140,3 +140,11 @@ QToolBox* QgisAppInterface::getToolBox() { return qgis->toolBox; } + +void QgisAppInterface::refreshLegend(QgsMapLayer *l) +{ + if(l && qgis && qgis->legend()) + { + qgis->legend()->refreshLayerSymbology( l->getLayerID() ); + } +} diff --git a/src/app/qgisappinterface.h b/src/app/qgisappinterface.h index 663c60f6c7c..e131d3df7be 100644 --- a/src/app/qgisappinterface.h +++ b/src/app/qgisappinterface.h @@ -104,6 +104,8 @@ class QgisAppInterface : public QgisInterface /** Return a pointer to the toolbox (where additional pages can be inserted) */ virtual QToolBox* getToolBox(); + virtual void refreshLegend(QgsMapLayer *l); + private: /// QgisInterface aren't copied diff --git a/src/gui/qgisinterface.h b/src/gui/qgisinterface.h index fb6b04b1d82..3ee61ab2a31 100644 --- a/src/gui/qgisinterface.h +++ b/src/gui/qgisinterface.h @@ -113,6 +113,9 @@ class GUI_EXPORT QgisInterface : public QObject /** Return a pointer to the toolbox (where additional pages can be inserted) */ virtual QToolBox* getToolBox()=0; + /** refresh the legend of a layer */ + virtual void refreshLegend(QgsMapLayer *l)=0; + signals: /** Emited whenever current (selected) layer changes. * The pointer to layer can be null if no layer is selected