QGIS API Documentation 3.36.0-Maidenhead (09951dc0acf)
|
The QgsMapLayerProxyModel class provides an easy to use model to display the list of layers in widgets. More...
#include <qgsmaplayerproxymodel.h>
Public Slots | |
void | setFilterString (const QString &filter) |
Sets a filter string, such that only layers with names matching the specified string will be shown. | |
Public Member Functions | |
QgsMapLayerProxyModel (QObject *parent=nullptr) | |
QgsMapLayerProxModel creates a proxy model with a QgsMapLayerModel as source model. | |
bool | acceptsLayer (QgsMapLayer *layer) const |
Returns true if the proxy model accepts the specified map layer. | |
QStringList | exceptedLayerIds () const |
Returns the blocklist of layer IDs which are excluded from the model. | |
QList< QgsMapLayer * > | exceptedLayerList () |
Returns the blocklist of layers which are excluded from the model. | |
QStringList | excludedProviders () const |
Returns the blocklist of data providers which are excluded from the model. | |
bool | filterAcceptsRow (int source_row, const QModelIndex &source_parent) const override |
const Qgis::LayerFilters & | filters () const |
Returns the filter flags which affect how layers are filtered within the model. | |
QString | filterString () const |
Returns the current filter string, if set. | |
QList< QgsMapLayer * > | layerAllowlist () |
Returns the list of layers which are excluded from the model. | |
Q_DECL_DEPRECATED QList< QgsMapLayer * > | layerWhitelist () |
Returns the list of layers which are excluded from the model. | |
bool | lessThan (const QModelIndex &left, const QModelIndex &right) const override |
void | setExceptedLayerIds (const QStringList &ids) |
Sets a blocklist of layers (by layer ID) to exclude from the model. | |
void | setExceptedLayerList (const QList< QgsMapLayer * > &exceptList) |
Sets a blocklist of layers to exclude from the model. | |
void | setExcludedProviders (const QStringList &providers) |
Sets a blocklist of data providers which should be excluded from the model. | |
Q_DECL_DEPRECATED void | setFilters (int filters) |
Filters according to layer type and/or geometry type. | |
QgsMapLayerProxyModel * | setFilters (Qgis::LayerFilters filters) |
Sets filter flags which affect how layers are filtered within the model. | |
void | setLayerAllowlist (const QList< QgsMapLayer * > &layers) |
Sets an allowlist of layers to include within the model. | |
Q_DECL_DEPRECATED void | setLayerWhitelist (const QList< QgsMapLayer * > &layers) |
Sets an allowlist of layers to include within the model. | |
void | setProject (QgsProject *project) |
Sets the project from which map layers are shown. | |
QgsMapLayerModel * | sourceLayerModel () const |
layerModel returns the QgsMapLayerModel used in this QSortFilterProxyModel | |
Static Public Member Functions | |
static bool | layerMatchesFilters (const QgsMapLayer *layer, const Qgis::LayerFilters &filters) |
Returns if the layer matches the given filters. | |
Properties | |
QStringList | exceptedLayerIds |
QList< QgsMapLayer * > | exceptedLayerList |
Qgis::LayerFilters | filters |
The QgsMapLayerProxyModel class provides an easy to use model to display the list of layers in widgets.
Definition at line 34 of file qgsmaplayerproxymodel.h.
|
explicit |
QgsMapLayerProxModel creates a proxy model with a QgsMapLayerModel as source model.
It can be used to filter the layers list in a widget.
Definition at line 22 of file qgsmaplayerproxymodel.cpp.
bool QgsMapLayerProxyModel::acceptsLayer | ( | QgsMapLayer * | layer | ) | const |
Returns true
if the proxy model accepts the specified map layer.
Definition at line 142 of file qgsmaplayerproxymodel.cpp.
QStringList QgsMapLayerProxyModel::exceptedLayerIds | ( | ) | const |
Returns the blocklist of layer IDs which are excluded from the model.
Definition at line 125 of file qgsmaplayerproxymodel.cpp.
|
inline |
Returns the blocklist of layers which are excluded from the model.
Definition at line 158 of file qgsmaplayerproxymodel.h.
|
inline |
Returns the blocklist of data providers which are excluded from the model.
Definition at line 184 of file qgsmaplayerproxymodel.h.
|
override |
Definition at line 171 of file qgsmaplayerproxymodel.cpp.
|
inline |
Returns the filter flags which affect how layers are filtered within the model.
Definition at line 77 of file qgsmaplayerproxymodel.h.
|
inline |
Returns the current filter string, if set.
Definition at line 192 of file qgsmaplayerproxymodel.h.
|
inline |
Returns the list of layers which are excluded from the model.
An empty list indicates that no filtering by allowlist should be performed.
Definition at line 142 of file qgsmaplayerproxymodel.h.
|
static |
Returns if the layer matches the given filters.
Definition at line 41 of file qgsmaplayerproxymodel.cpp.
|
inline |
Returns the list of layers which are excluded from the model.
An empty list indicates that no filtering by allowlist should be performed.
Definition at line 130 of file qgsmaplayerproxymodel.h.
|
override |
Definition at line 185 of file qgsmaplayerproxymodel.cpp.
void QgsMapLayerProxyModel::setExceptedLayerIds | ( | const QStringList & | ids | ) |
Sets a blocklist of layers (by layer ID) to exclude from the model.
Definition at line 111 of file qgsmaplayerproxymodel.cpp.
void QgsMapLayerProxyModel::setExceptedLayerList | ( | const QList< QgsMapLayer * > & | exceptList | ) |
Sets a blocklist of layers to exclude from the model.
Definition at line 97 of file qgsmaplayerproxymodel.cpp.
void QgsMapLayerProxyModel::setExcludedProviders | ( | const QStringList & | providers | ) |
Sets a blocklist of data providers which should be excluded from the model.
Definition at line 136 of file qgsmaplayerproxymodel.cpp.
|
inline |
Filters according to layer type and/or geometry type.
Definition at line 69 of file qgsmaplayerproxymodel.h.
QgsMapLayerProxyModel * QgsMapLayerProxyModel::setFilters | ( | Qgis::LayerFilters | filters | ) |
Sets filter flags which affect how layers are filtered within the model.
Definition at line 34 of file qgsmaplayerproxymodel.cpp.
|
slot |
Sets a filter string, such that only layers with names matching the specified string will be shown.
Definition at line 165 of file qgsmaplayerproxymodel.cpp.
void QgsMapLayerProxyModel::setLayerAllowlist | ( | const QList< QgsMapLayer * > & | layers | ) |
Sets an allowlist of layers to include within the model.
Only layers from this list will be shown.
An empty list indicates that no filter by allowlist should be performed.
Definition at line 88 of file qgsmaplayerproxymodel.cpp.
void QgsMapLayerProxyModel::setLayerWhitelist | ( | const QList< QgsMapLayer * > & | layers | ) |
Sets an allowlist of layers to include within the model.
Only layers from this list will be shown.
An empty list indicates that no filter by allowlist should be performed.
Definition at line 83 of file qgsmaplayerproxymodel.cpp.
void QgsMapLayerProxyModel::setProject | ( | QgsProject * | project | ) |
Sets the project from which map layers are shown.
If project is nullptr
then QgsProject::instance() will be used.
Definition at line 106 of file qgsmaplayerproxymodel.cpp.
|
inline |
layerModel returns the QgsMapLayerModel used in this QSortFilterProxyModel
Definition at line 53 of file qgsmaplayerproxymodel.h.
|
readwrite |
Definition at line 40 of file qgsmaplayerproxymodel.h.
|
readwrite |
Definition at line 39 of file qgsmaplayerproxymodel.h.
|
readwrite |
Definition at line 38 of file qgsmaplayerproxymodel.h.