QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 (const QString &name, bool expand=true, QTreeWidgetItem *parent=nullptr)=0
 Add a new group a parent group can be given to nest the new group in it. More...
 
virtual int addGroup (const 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 moveLayer (QgsMapLayer *ml, int groupIndex)=0
 Move a layer to a group. More...
 
virtual void refreshLayerSymbology (QgsMapLayer *ml)=0
 Refresh layer symbology. More...
 
virtual void removeGroup (int groupIndex)=0
 Remove group on index. More...
 
virtual void setGroupExpanded (int groupIndex, bool expand)=0
 Collapse or expand a group. More...
 
virtual void setGroupVisible (int groupIndex, bool visible)=0
 Set the visibility of a group. More...
 
virtual void setLayerExpanded (QgsMapLayer *ml, bool expand)=0
 Collapse or expand a layer. More...
 
virtual void setLayerVisible (QgsMapLayer *ml, bool visible)=0
 Set the visibility of a layer. More...
 

Signals

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

Public Member Functions

 QgsLegendInterface ()
 Constructor. More...
 
virtual ~QgsLegendInterface ()
 Virtual destructor. 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 QgsMapLayercurrentLayer ()=0
 Returns the current layer if the current item is a QgsLegendLayer. More...
 
virtual bool groupExists (int groupIndex)=0
 Check if a group exists. More...
 
virtual QList< GroupLayerInfogroupLayerRelationship ()
 Return the relationship between groups and layers in the legend. More...
 
virtual QStringList groups ()=0
 Return a string list of groups. 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 QList< QgsMapLayer *> layers () const =0
 Return all layers in the project in drawing order. More...
 
virtual bool removeLegendLayerAction (QAction *action)=0
 Remove action for layers in the legend. More...
 
virtual QList< QgsMapLayer * > selectedLayers (bool inDrawOrder=false) const =0
 Returns the currently selected layers of QgsLegendLayers. More...
 
virtual bool setCurrentLayer (QgsMapLayer *layer)=0
 set the current layer returns true if the layer exists, false otherwise More...
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual ~QObject ()
 
bool blockSignals (bool block)
 
QObjectchild (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArraydynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObjectparent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThreadthread () const
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObjectsender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

QgsLegendInterface Abstract base class to make QgsLegend available to plugins.

Definition at line 40 of file qgslegendinterface.h.

Constructor & Destructor Documentation

◆ QgsLegendInterface()

QgsLegendInterface::QgsLegendInterface ( )

Constructor.

Definition at line 19 of file qgslegendinterface.cpp.

◆ ~QgsLegendInterface()

QgsLegendInterface::~QgsLegendInterface ( )
virtual

Virtual destructor.

Definition at line 23 of file qgslegendinterface.cpp.

Member Function Documentation

◆ addGroup [1/2]

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

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

◆ addGroup [2/2]

virtual int QgsLegendInterface::addGroup ( const 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.

◆ addLegendLayerAction()

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

Add action for layers in the legend.

◆ addLegendLayerActionForLayer()

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 )

◆ currentLayer()

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.

◆ currentLayerChanged

void QgsLegendInterface::currentLayerChanged ( QgsMapLayer layer)
signal

Emitted whenever current (selected) layer changes.

◆ groupExists()

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

Check if a group exists.

◆ groupIndexChanged

void QgsLegendInterface::groupIndexChanged ( int  oldIndex,
int  newIndex 
)
signal

emitted when a group index has changed

◆ groupLayerRelationship()

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

Return the relationship between groups and layers in the legend.

Definition at line 56 of file qgslegendinterface.h.

◆ groupRelationsChanged

void QgsLegendInterface::groupRelationsChanged ( )
signal

◆ groups()

virtual QStringList QgsLegendInterface::groups ( )
pure virtual

Return a string list of groups.

◆ isGroupExpanded()

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

Check if a group is expanded.

◆ isGroupVisible()

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

Check if a group is visible.

◆ isLayerExpanded()

virtual bool QgsLegendInterface::isLayerExpanded ( QgsMapLayer ml)
pure virtual

Check if a layer is expanded.

◆ isLayerVisible()

virtual bool QgsLegendInterface::isLayerVisible ( QgsMapLayer ml)
pure virtual

Check if a layer is visible.

◆ itemAdded

void QgsLegendInterface::itemAdded ( const QModelIndex index)
signal

◆ itemRemoved

void QgsLegendInterface::itemRemoved ( )
signal

◆ layers()

virtual QList< QgsMapLayer * > QgsLegendInterface::layers ( ) const
pure virtual

Return all layers in the project in drawing order.

◆ moveLayer

virtual void QgsLegendInterface::moveLayer ( QgsMapLayer ml,
int  groupIndex 
)
pure virtualslot

Move a layer to a group.

◆ refreshLayerSymbology

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

Refresh layer symbology.

◆ removeGroup

virtual void QgsLegendInterface::removeGroup ( int  groupIndex)
pure virtualslot

Remove group on index.

◆ removeLegendLayerAction()

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

Remove action for layers in the legend.

◆ selectedLayers()

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

Returns the currently selected layers of QgsLegendLayers.

Parameters
inDrawOrderreturn layers in drawing order
Returns
list of layers, else an empty list

◆ setCurrentLayer()

virtual bool QgsLegendInterface::setCurrentLayer ( QgsMapLayer layer)
pure virtual

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

◆ setGroupExpanded

virtual void QgsLegendInterface::setGroupExpanded ( int  groupIndex,
bool  expand 
)
pure virtualslot

Collapse or expand a group.

◆ setGroupVisible

virtual void QgsLegendInterface::setGroupVisible ( int  groupIndex,
bool  visible 
)
pure virtualslot

Set the visibility of a group.

◆ setLayerExpanded

virtual void QgsLegendInterface::setLayerExpanded ( QgsMapLayer ml,
bool  expand 
)
pure virtualslot

Collapse or expand a layer.

◆ setLayerVisible

virtual void QgsLegendInterface::setLayerVisible ( QgsMapLayer ml,
bool  visible 
)
pure virtualslot

Set the visibility of a layer.


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