Skip to content

Commit 8f011fc

Browse files
author
rblazek
committed
added currentLayerChanged
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5113 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 4031cc4 commit 8f011fc

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/gui/qgisiface.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@
2424
#include "qgisapp.h"
2525
#include "qgsmaplayer.h"
2626
#include "qgsmapcanvas.h"
27+
#include "qgslegend.h"
2728

2829
QgisIface::QgisIface(QgisApp * _qgis, const char *name):qgis(_qgis)
2930
{
31+
connect ( qgis->legend(), SIGNAL(currentLayerChanged(QgsMapLayer *)),
32+
this, SLOT(emitCurrentLayerChanged(QgsMapLayer *)) );
3033

3134
}
3235

@@ -136,3 +139,9 @@ QgisIface::app()
136139
{
137140
return qgis;
138141
} // QgisIface::app()
142+
143+
void QgisIface::emitCurrentLayerChanged ( QgsMapLayer * layer )
144+
{
145+
// Does not compile
146+
//emit currentLayerChanged ( layer );
147+
}

src/gui/qgisiface.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,15 @@ class QgisIface : public QgisInterface{
104104
*/
105105
QgisApp * app();
106106

107+
public slots:
108+
void emitCurrentLayerChanged ( QgsMapLayer * layer );
109+
110+
111+
signals:
112+
//! Emited whenever current (selected) layer changes
113+
// the pointer to layer can be null if no layer is selected
114+
void currentLayerChanged ( QgsMapLayer * layer );
115+
107116
private:
108117

109118
/// QgisIface aren't copied

0 commit comments

Comments
 (0)