QGIS API Documentation  3.4.15-Madeira (e83d02e274)
Public Slots | Signals | Public Member Functions | Protected Slots | Properties | List of all members
QgsMapLayerComboBox Class Reference

The QgsMapLayerComboBox class is a combo box which displays the list of layers. More...

#include <qgsmaplayercombobox.h>

Inheritance diagram for QgsMapLayerComboBox:
Inheritance graph
[legend]

Public Slots

void setLayer (QgsMapLayer *layer)
 setLayer set the current layer selected in the combo More...
 

Signals

void layerChanged (QgsMapLayer *layer)
 layerChanged this signal is emitted whenever the currently selected layer changes More...
 

Public Member Functions

 QgsMapLayerComboBox (QWidget *parent=nullptr)
 QgsMapLayerComboBox creates a combo box to display the list of layers (currently in the registry). More...
 
QStringList additionalItems () const
 Returns the list of additional (non map layer) items included at the end of the combo box. More...
 
bool allowEmptyLayer () const
 Returns true if the combo box allows the empty layer ("not set") choice. More...
 
QgsMapLayercurrentLayer () const
 Returns the current layer selected in the combo box. More...
 
QList< QgsMapLayer * > exceptedLayerList () const
 returns the list of excepted layers More...
 
QStringList excludedProviders () const
 Returns the list of data providers which are excluded from the combobox. More...
 
QgsMapLayerProxyModel::Filters filters () const
 currently used filter on list layers More...
 
QgsMapLayerlayer (int layerIndex) const
 Returns the layer currently shown at the specified index within the combo box. More...
 
void setAdditionalItems (const QStringList &items)
 Sets a list of additional (non map layer) items to include at the end of the combobox. More...
 
void setAllowEmptyLayer (bool allowEmpty)
 Sets whether an optional empty layer ("not set") option is shown in the combo box. More...
 
void setExceptedLayerList (const QList< QgsMapLayer * > &layerList)
 except a list of layers not to be listed More...
 
void setExcludedProviders (const QStringList &providers)
 Sets a list of data providers which should be excluded from the combobox. More...
 
void setFilters (QgsMapLayerProxyModel::Filters filters)
 setFilters allows fitering according to layer type and/or geometry type. More...
 
void setShowCrs (bool showCrs)
 Sets whether the CRS of layers is also included in the combo box text. More...
 
bool showCrs () const
 Returns true if the combo box shows the layer's CRS. More...
 

Protected Slots

void indexChanged (int i)
 
void rowsChanged ()
 

Properties

bool allowEmptyLayer
 
QStringList excludedProviders
 
QgsMapLayerProxyModel::Filters filters
 
bool showCrs
 

Detailed Description

The QgsMapLayerComboBox class is a combo box which displays the list of layers.

Since
QGIS 2.3

Definition at line 34 of file qgsmaplayercombobox.h.

Constructor & Destructor Documentation

QgsMapLayerComboBox::QgsMapLayerComboBox ( QWidget *  parent = nullptr)
explicit

QgsMapLayerComboBox creates a combo box to display the list of layers (currently in the registry).

The layers can be filtered and/or ordered.

Definition at line 20 of file qgsmaplayercombobox.cpp.

Member Function Documentation

QStringList QgsMapLayerComboBox::additionalItems ( ) const

Returns the list of additional (non map layer) items included at the end of the combo box.

See also
setAdditionalItems()
Since
QGIS 3.0

Definition at line 66 of file qgsmaplayercombobox.cpp.

bool QgsMapLayerComboBox::allowEmptyLayer ( ) const

Returns true if the combo box allows the empty layer ("not set") choice.

See also
setAllowEmptyLayer()
Since
QGIS 3.0
QgsMapLayer * QgsMapLayerComboBox::currentLayer ( ) const

Returns the current layer selected in the combo box.

See also
layer

Definition at line 94 of file qgsmaplayercombobox.cpp.

QList<QgsMapLayer *> QgsMapLayerComboBox::exceptedLayerList ( ) const
inline

returns the list of excepted layers

Definition at line 60 of file qgsmaplayercombobox.h.

QStringList QgsMapLayerComboBox::excludedProviders ( ) const

Returns the list of data providers which are excluded from the combobox.

See also
setExcludedProviders()
Since
QGIS 3.0
QgsMapLayerProxyModel::Filters QgsMapLayerComboBox::filters ( ) const
inline

currently used filter on list layers

Definition at line 54 of file qgsmaplayercombobox.h.

void QgsMapLayerComboBox::indexChanged ( int  i)
protectedslot

Definition at line 121 of file qgsmaplayercombobox.cpp.

QgsMapLayer * QgsMapLayerComboBox::layer ( int  layerIndex) const

Returns the layer currently shown at the specified index within the combo box.

Parameters
layerIndexposition of layer to return
See also
currentLayer
Since
QGIS 2.10

Definition at line 99 of file qgsmaplayercombobox.cpp.

void QgsMapLayerComboBox::layerChanged ( QgsMapLayer layer)
signal

layerChanged this signal is emitted whenever the currently selected layer changes

void QgsMapLayerComboBox::rowsChanged ( )
protectedslot

Definition at line 128 of file qgsmaplayercombobox.cpp.

void QgsMapLayerComboBox::setAdditionalItems ( const QStringList &  items)

Sets a list of additional (non map layer) items to include at the end of the combobox.

These may represent additional layers such as layers which are not included in the map layer registry, or paths to layers which have not yet been loaded into QGIS.

See also
additionalItems()
Since
QGIS 3.0

Definition at line 61 of file qgsmaplayercombobox.cpp.

void QgsMapLayerComboBox::setAllowEmptyLayer ( bool  allowEmpty)

Sets whether an optional empty layer ("not set") option is shown in the combo box.

See also
allowEmptyLayer()
Since
QGIS 3.0

Definition at line 41 of file qgsmaplayercombobox.cpp.

void QgsMapLayerComboBox::setExceptedLayerList ( const QList< QgsMapLayer * > &  layerList)
inline

except a list of layers not to be listed

Definition at line 57 of file qgsmaplayercombobox.h.

void QgsMapLayerComboBox::setExcludedProviders ( const QStringList &  providers)

Sets a list of data providers which should be excluded from the combobox.

See also
excludedProviders()
Since
QGIS 3.0

Definition at line 31 of file qgsmaplayercombobox.cpp.

void QgsMapLayerComboBox::setFilters ( QgsMapLayerProxyModel::Filters  filters)
inline

setFilters allows fitering according to layer type and/or geometry type.

Definition at line 51 of file qgsmaplayercombobox.h.

void QgsMapLayerComboBox::setLayer ( QgsMapLayer layer)
slot

setLayer set the current layer selected in the combo

Definition at line 71 of file qgsmaplayercombobox.cpp.

void QgsMapLayerComboBox::setShowCrs ( bool  showCrs)

Sets whether the CRS of layers is also included in the combo box text.

See also
showCrs()
Since
QGIS 3.0

Definition at line 51 of file qgsmaplayercombobox.cpp.

bool QgsMapLayerComboBox::showCrs ( ) const

Returns true if the combo box shows the layer's CRS.

See also
setShowCrs()
Since
QGIS 3.0

Property Documentation

bool QgsMapLayerComboBox::allowEmptyLayer
readwrite

Definition at line 38 of file qgsmaplayercombobox.h.

QStringList QgsMapLayerComboBox::excludedProviders
readwrite

Definition at line 40 of file qgsmaplayercombobox.h.

QgsMapLayerProxyModel::Filters QgsMapLayerComboBox::filters
readwrite

Definition at line 37 of file qgsmaplayercombobox.h.

bool QgsMapLayerComboBox::showCrs
readwrite

Definition at line 39 of file qgsmaplayercombobox.h.


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