QGIS API Documentation
3.20.0-Odense (decaadbb31)
|
The QgsMapLayerProxyModel class provides an easy to use model to display the list of layers in widgets. More...
#include <qgsmaplayerproxymodel.h>
Public Types | |
enum | Filter { RasterLayer = 1 , NoGeometry = 2 , PointLayer = 4 , LineLayer = 8 , PolygonLayer = 16 , HasGeometry = PointLayer | LineLayer | PolygonLayer , VectorLayer = NoGeometry | HasGeometry , PluginLayer = 32 , WritableLayer = 64 , MeshLayer = 128 , VectorTileLayer = 256 , PointCloudLayer = 512 , All = RasterLayer | VectorLayer | PluginLayer | MeshLayer | VectorTileLayer | PointCloudLayer } |
Public Slots | |
void | setFilterString (const QString &filter) |
Sets a filter string, such that only layers with names matching the specified string will be shown. More... | |
Public Member Functions | |
QgsMapLayerProxyModel (QObject *parent=nullptr) | |
QgsMapLayerProxModel creates a proxy model with a QgsMapLayerModel as source model. More... | |
bool | acceptsLayer (QgsMapLayer *layer) const |
Returns true if the proxy model accepts the specified map layer. More... | |
QStringList | exceptedLayerIds () const |
Returns the blocklist of layer IDs which are excluded from the model. More... | |
QList< QgsMapLayer * > | exceptedLayerList () |
Returns the blocklist of layers which are excluded from the model. More... | |
QStringList | excludedProviders () const |
Returns the blocklist of data providers which are excluded from the model. More... | |
bool | filterAcceptsRow (int source_row, const QModelIndex &source_parent) const override |
const Filters & | filters () const |
Returns the filter flags which affect how layers are filtered within the model. More... | |
QString | filterString () const |
Returns the current filter string, if set. More... | |
QList< QgsMapLayer * > | layerAllowlist () |
Returns the list of layers which are excluded from the model. More... | |
Q_DECL_DEPRECATED QList< QgsMapLayer * > | layerWhitelist () |
Returns the list of layers which are excluded from the model. More... | |
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. More... | |
void | setExceptedLayerList (const QList< QgsMapLayer * > &exceptList) |
Sets a blocklist of layers to exclude from the model. More... | |
void | setExcludedProviders (const QStringList &providers) |
Sets a blocklist of data providers which should be excluded from the model. More... | |
QgsMapLayerProxyModel * | setFilters (QgsMapLayerProxyModel::Filters filters) |
Sets filter flags which affect how layers are filtered within the model. More... | |
void | setLayerAllowlist (const QList< QgsMapLayer * > &layers) |
Sets an allowlist of layers to include within the model. More... | |
Q_DECL_DEPRECATED void | setLayerWhitelist (const QList< QgsMapLayer * > &layers) |
Sets an allowlist of layers to include within the model. More... | |
QgsMapLayerModel * | sourceLayerModel () const |
layerModel returns the QgsMapLayerModel used in this QSortFilterProxyModel More... | |
Static Public Member Functions | |
static bool | layerMatchesFilters (const QgsMapLayer *layer, const Filters &filters) |
Returns if the layer matches the given filters. More... | |
Properties | |
QStringList | exceptedLayerIds |
QList< QgsMapLayer * > | exceptedLayerList |
QgsMapLayerProxyModel::Filters | filters |
The QgsMapLayerProxyModel class provides an easy to use model to display the list of layers in widgets.
Definition at line 33 of file qgsmaplayerproxymodel.h.
Definition at line 42 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 27 of file qgsmaplayerproxymodel.cpp.
bool QgsMapLayerProxyModel::acceptsLayer | ( | QgsMapLayer * | layer | ) | const |
Returns true
if the proxy model accepts the specified map layer.
Definition at line 140 of file qgsmaplayerproxymodel.cpp.
QStringList QgsMapLayerProxyModel::exceptedLayerIds | ( | ) | const |
Returns the blocklist of layer IDs which are excluded from the model.
Definition at line 123 of file qgsmaplayerproxymodel.cpp.
|
inline |
Returns the blocklist of layers which are excluded from the model.
Definition at line 160 of file qgsmaplayerproxymodel.h.
|
inline |
Returns the blocklist of data providers which are excluded from the model.
Definition at line 188 of file qgsmaplayerproxymodel.h.
|
override |
Definition at line 169 of file qgsmaplayerproxymodel.cpp.
|
inline |
Returns the filter flags which affect how layers are filtered within the model.
Definition at line 88 of file qgsmaplayerproxymodel.h.
|
inline |
Returns the current filter string, if set.
Definition at line 196 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 144 of file qgsmaplayerproxymodel.h.
|
static |
Returns if the layer matches the given filters.
Definition at line 46 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 132 of file qgsmaplayerproxymodel.h.
|
override |
Definition at line 183 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 109 of file qgsmaplayerproxymodel.cpp.
void QgsMapLayerProxyModel::setExceptedLayerList | ( | const QList< QgsMapLayer * > & | exceptList | ) |
Sets a blocklist of layers to exclude from the model.
Definition at line 100 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 134 of file qgsmaplayerproxymodel.cpp.
QgsMapLayerProxyModel * QgsMapLayerProxyModel::setFilters | ( | QgsMapLayerProxyModel::Filters | filters | ) |
Sets filter flags which affect how layers are filtered within the model.
Definition at line 39 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 163 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 91 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 86 of file qgsmaplayerproxymodel.cpp.
|
inline |
layerModel returns the QgsMapLayerModel used in this QSortFilterProxyModel
Definition at line 70 of file qgsmaplayerproxymodel.h.
|
readwrite |
Definition at line 1 of file qgsmaplayerproxymodel.h.
|
readwrite |
Definition at line 1 of file qgsmaplayerproxymodel.h.
|
readwrite |
Definition at line 1 of file qgsmaplayerproxymodel.h.