QGIS API Documentation
3.22.4-Białowieża (ce8e65e95e)
|
The QgsMapLayerComboBox class is a combo box which displays the list of layers. More...
#include <qgsmaplayercombobox.h>
Public Slots | |
void | setLayer (QgsMapLayer *layer) |
setLayer set the current layer selected in the combo More... | |
Signals | |
void | layerChanged (QgsMapLayer *layer) |
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... | |
QList< QgsMapLayer * > | additionalLayers () const |
Returns the list of additional layers added to the combobox. More... | |
bool | allowEmptyLayer () const |
Returns true if the combo box allows the empty layer ("not set") choice. More... | |
QgsMapLayer * | currentLayer () 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... | |
QgsMapLayer * | layer (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 | setAdditionalLayers (const QList< QgsMapLayer * > &layers) |
Sets a list of additional layers to include in the combobox. More... | |
void | setAllowEmptyLayer (bool allowEmpty, const QString &text=QString(), const QIcon &icon=QIcon()) |
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 filtering 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 () |
Protected Member Functions | |
void | dragEnterEvent (QDragEnterEvent *event) override |
void | dragLeaveEvent (QDragLeaveEvent *event) override |
void | dropEvent (QDropEvent *event) override |
void | paintEvent (QPaintEvent *e) override |
Properties | |
bool | allowEmptyLayer |
QStringList | excludedProviders |
QgsMapLayerProxyModel::Filters | filters |
bool | showCrs |
Friends | |
class | QgsProcessingMapLayerComboBox |
The QgsMapLayerComboBox class is a combo box which displays the list of layers.
Definition at line 34 of file qgsmaplayercombobox.h.
|
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 22 of file qgsmaplayercombobox.cpp.
QStringList QgsMapLayerComboBox::additionalItems | ( | ) | const |
Returns the list of additional (non map layer) items included at the end of the combo box.
Definition at line 72 of file qgsmaplayercombobox.cpp.
QList< QgsMapLayer * > QgsMapLayerComboBox::additionalLayers | ( | ) | const |
Returns the list of additional layers added to the combobox.
Definition at line 82 of file qgsmaplayercombobox.cpp.
bool QgsMapLayerComboBox::allowEmptyLayer | ( | ) | const |
Returns true
if the combo box allows the empty layer ("not set") choice.
Definition at line 52 of file qgsmaplayercombobox.cpp.
QgsMapLayer * QgsMapLayerComboBox::currentLayer | ( | ) | const |
Returns the current layer selected in the combo box.
Definition at line 114 of file qgsmaplayercombobox.cpp.
|
overrideprotected |
Definition at line 176 of file qgsmaplayercombobox.cpp.
|
overrideprotected |
Definition at line 198 of file qgsmaplayercombobox.cpp.
|
overrideprotected |
Definition at line 212 of file qgsmaplayercombobox.cpp.
|
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.
Definition at line 42 of file qgsmaplayercombobox.cpp.
|
inline |
currently used filter on list layers
Definition at line 54 of file qgsmaplayercombobox.h.
|
protectedslot |
Definition at line 141 of file qgsmaplayercombobox.cpp.
QgsMapLayer * QgsMapLayerComboBox::layer | ( | int | layerIndex | ) | const |
Returns the layer currently shown at the specified index within the combo box.
layerIndex | position of layer to return |
Definition at line 119 of file qgsmaplayercombobox.cpp.
|
signal |
Emitted whenever the currently selected layer changes.
|
overrideprotected |
Definition at line 237 of file qgsmaplayercombobox.cpp.
|
protectedslot |
Definition at line 148 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.
Definition at line 67 of file qgsmaplayercombobox.cpp.
void QgsMapLayerComboBox::setAdditionalLayers | ( | const QList< QgsMapLayer * > & | layers | ) |
Sets a list of additional layers to include in the combobox.
This method allows adding additional layers, which are not part of a project's layers, into the combobox.
Definition at line 77 of file qgsmaplayercombobox.cpp.
void QgsMapLayerComboBox::setAllowEmptyLayer | ( | bool | allowEmpty, |
const QString & | text = QString() , |
||
const QIcon & | icon = QIcon() |
||
) |
Sets whether an optional empty layer ("not set") option is shown in the combo box.
Since QGIS 3.20, the optional text and icon arguments allows the text and icon for the empty layer item to be set.
Definition at line 47 of file qgsmaplayercombobox.cpp.
|
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.
Definition at line 37 of file qgsmaplayercombobox.cpp.
|
inline |
setFilters allows filtering according to layer type and/or geometry type.
Definition at line 51 of file qgsmaplayercombobox.h.
|
slot |
setLayer set the current layer selected in the combo
Definition at line 87 of file qgsmaplayercombobox.cpp.
void QgsMapLayerComboBox::setShowCrs | ( | bool | showCrs | ) |
Sets whether the CRS of layers is also included in the combo box text.
Definition at line 57 of file qgsmaplayercombobox.cpp.
bool QgsMapLayerComboBox::showCrs | ( | ) | const |
Returns true
if the combo box shows the layer's CRS.
Definition at line 62 of file qgsmaplayercombobox.cpp.
|
friend |
Definition at line 186 of file qgsmaplayercombobox.h.
|
readwrite |
Definition at line 1 of file qgsmaplayercombobox.h.
|
readwrite |
Definition at line 1 of file qgsmaplayercombobox.h.
|
readwrite |
Definition at line 1 of file qgsmaplayercombobox.h.
|
readwrite |
Definition at line 1 of file qgsmaplayercombobox.h.