QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Slots | Signals | Public Member Functions | List of all members
QgsLegendInterface Class Referenceabstract

QgsLegendInterface Abstract base class to make QgsLegend available to plugins. More...

#include <qgslegendinterface.h>

Inheritance diagram for QgsLegendInterface:
Inheritance graph
[legend]

Public Slots

virtual int addGroup (QString name, bool expand=true, QTreeWidgetItem *parent=0)=0
 Add a new group a parent group can be given to nest the new group in it. More...
 
virtual int addGroup (QString name, bool expand, int parentIndex)=0
 Add a new group a parent group index has to be given to nest the new group in it. More...
 
virtual void removeGroup (int groupIndex)=0
 Remove group on index. More...
 
virtual void moveLayer (QgsMapLayer *ml, int groupIndex)=0
 Move a layer to a group. More...
 
virtual void setGroupExpanded (int groupIndex, bool expand)=0
 Collapse or expand a group. More...
 
virtual void setLayerExpanded (QgsMapLayer *ml, bool expand)=0
 Collapse or expand a layer. More...
 
virtual void setGroupVisible (int groupIndex, bool visible)=0
 Set the visibility of a group. More...
 
virtual void setLayerVisible (QgsMapLayer *ml, bool visible)=0
 Set the visibility of a layer. More...
 
virtual void refreshLayerSymbology (QgsMapLayer *ml)=0
 Refresh layer symbology. More...
 

Signals

void groupIndexChanged (int oldIndex, int newIndex)
 emitted when a group index has changed More...
 
void groupRelationsChanged ()
 
void itemAdded (QModelIndex index)
 
void itemRemoved ()
 
void currentLayerChanged (QgsMapLayer *layer)
 Emitted whenever current (selected) layer changes. More...
 

Public Member Functions

 QgsLegendInterface ()
 Constructor. More...
 
virtual ~QgsLegendInterface ()
 Virtual destructor. More...
 
virtual QStringList groups ()=0
 Return a string list of groups. More...
 
virtual QList< GroupLayerInfogroupLayerRelationship ()
 Return the relationship between groups and layers in the legend. More...
 
virtual QList< QgsMapLayer * > selectedLayers (bool inDrawOrder=false) const =0
 Returns the currently selected layers of QgsLegendLayers. More...
 
virtual QList< QgsMapLayer * > layers () const =0
 Return all layers in the project in drawing order. More...
 
virtual bool groupExists (int groupIndex)=0
 Check if a group exists. More...
 
virtual bool isGroupExpanded (int groupIndex)=0
 Check if a group is expanded. More...
 
virtual bool isGroupVisible (int groupIndex)=0
 Check if a group is visible. More...
 
virtual bool isLayerExpanded (QgsMapLayer *ml)=0
 Check if a layer is expanded. More...
 
virtual bool isLayerVisible (QgsMapLayer *ml)=0
 Check if a layer is visible. More...
 
virtual void addLegendLayerAction (QAction *action, QString menu, QString id, QgsMapLayer::LayerType type, bool allLayers)=0
 Add action for layers in the legend. More...
 
virtual void addLegendLayerActionForLayer (QAction *action, QgsMapLayer *layer)=0
 Add action for a specific layers in the legend. More...
 
virtual bool removeLegendLayerAction (QAction *action)=0
 Remove action for layers in the legend. More...
 
virtual QgsMapLayercurrentLayer ()=0
 Returns the current layer if the current item is a QgsLegendLayer. More...
 
virtual bool setCurrentLayer (QgsMapLayer *layer)=0
 set the current layer returns true if the layer exists, false otherwise More...
 

Detailed Description

QgsLegendInterface Abstract base class to make QgsLegend available to plugins.

Note
added in 1.4

Constructor & Destructor Documentation

QgsLegendInterface::QgsLegendInterface ( )

Constructor.

QgsLegendInterface::~QgsLegendInterface ( )
virtual

Virtual destructor.

Member Function Documentation

virtual int QgsLegendInterface::addGroup ( QString  name,
bool  expand = true,
QTreeWidgetItem *  parent = 0 
)
pure virtualslot

Add a new group a parent group can be given to nest the new group in it.

virtual int QgsLegendInterface::addGroup ( QString  name,
bool  expand,
int  parentIndex 
)
pure virtualslot

Add a new group a parent group index has to be given to nest the new group in it.

virtual void QgsLegendInterface::addLegendLayerAction ( QAction *  action,
QString  menu,
QString  id,
QgsMapLayer::LayerType  type,
bool  allLayers 
)
pure virtual

Add action for layers in the legend.

Note
added in 2.0
virtual void QgsLegendInterface::addLegendLayerActionForLayer ( QAction *  action,
QgsMapLayer layer 
)
pure virtual

Add action for a specific layers in the legend.

Use this in combination with addLegendLayerAction( allLayers = False )

Note
added in 2.0
virtual QgsMapLayer* QgsLegendInterface::currentLayer ( )
pure virtual

Returns the current layer if the current item is a QgsLegendLayer.

If the current item is a QgsLegendLayer, its first maplayer is returned. Else, 0 is returned.

Note
Added in 2.0
void QgsLegendInterface::currentLayerChanged ( QgsMapLayer layer)
signal

Emitted whenever current (selected) layer changes.

Note
Added in 2.0
virtual bool QgsLegendInterface::groupExists ( int  groupIndex)
pure virtual

Check if a group exists.

Note
added in 1.5
void QgsLegendInterface::groupIndexChanged ( int  oldIndex,
int  newIndex 
)
signal

emitted when a group index has changed

virtual QList< GroupLayerInfo > QgsLegendInterface::groupLayerRelationship ( )
inlinevirtual

Return the relationship between groups and layers in the legend.

void QgsLegendInterface::groupRelationsChanged ( )
signal
virtual QStringList QgsLegendInterface::groups ( )
pure virtual

Return a string list of groups.

virtual bool QgsLegendInterface::isGroupExpanded ( int  groupIndex)
pure virtual

Check if a group is expanded.

Note
added in 1.5
virtual bool QgsLegendInterface::isGroupVisible ( int  groupIndex)
pure virtual

Check if a group is visible.

Note
added in 1.5
virtual bool QgsLegendInterface::isLayerExpanded ( QgsMapLayer ml)
pure virtual

Check if a layer is expanded.

Note
added in 2.0
virtual bool QgsLegendInterface::isLayerVisible ( QgsMapLayer ml)
pure virtual

Check if a layer is visible.

Note
added in 1.5
void QgsLegendInterface::itemAdded ( QModelIndex  index)
signal
void QgsLegendInterface::itemRemoved ( )
signal
virtual QList< QgsMapLayer * > QgsLegendInterface::layers ( ) const
pure virtual

Return all layers in the project in drawing order.

Note
added in 1.5
virtual void QgsLegendInterface::moveLayer ( QgsMapLayer ml,
int  groupIndex 
)
pure virtualslot

Move a layer to a group.

virtual void QgsLegendInterface::refreshLayerSymbology ( QgsMapLayer ml)
pure virtualslot

Refresh layer symbology.

Note
added in 1.5
virtual void QgsLegendInterface::removeGroup ( int  groupIndex)
pure virtualslot

Remove group on index.

virtual bool QgsLegendInterface::removeLegendLayerAction ( QAction *  action)
pure virtual

Remove action for layers in the legend.

Note
added in 2.0
virtual QList<QgsMapLayer *> QgsLegendInterface::selectedLayers ( bool  inDrawOrder = false) const
pure virtual

Returns the currently selected layers of QgsLegendLayers.

Parameters
inDrawOrderreturn layers in drawing order (added in 1.9)
Returns
list of layers, else an empty list
virtual bool QgsLegendInterface::setCurrentLayer ( QgsMapLayer layer)
pure virtual

set the current layer returns true if the layer exists, false otherwise

Note
Added in 2.0
virtual void QgsLegendInterface::setGroupExpanded ( int  groupIndex,
bool  expand 
)
pure virtualslot

Collapse or expand a group.

Note
added in 1.5
virtual void QgsLegendInterface::setGroupVisible ( int  groupIndex,
bool  visible 
)
pure virtualslot

Set the visibility of a group.

Note
added in 1.5
virtual void QgsLegendInterface::setLayerExpanded ( QgsMapLayer ml,
bool  expand 
)
pure virtualslot

Collapse or expand a layer.

Note
added in 2.0
virtual void QgsLegendInterface::setLayerVisible ( QgsMapLayer ml,
bool  visible 
)
pure virtualslot

Set the visibility of a layer.

Note
added in 1.5

The documentation for this class was generated from the following files: