QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
|
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 , AnnotationLayer = 1024 , All = RasterLayer | VectorLayer | PluginLayer | MeshLayer | VectorTileLayer | PointCloudLayer | AnnotationLayer , SpatialLayer = RasterLayer | HasGeometry | PluginLayer | MeshLayer | VectorTileLayer | PointCloudLayer | AnnotationLayer } |
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... | |
void | setProject (QgsProject *project) |
Sets the project from which map layers are shown. 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 34 of file qgsmaplayerproxymodel.h.
Definition at line 43 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 146 of file qgsmaplayerproxymodel.cpp.
QStringList QgsMapLayerProxyModel::exceptedLayerIds | ( | ) | const |
Returns the blocklist of layer IDs which are excluded from the model.
Definition at line 129 of file qgsmaplayerproxymodel.cpp.
|
inline |
Returns the blocklist of layers which are excluded from the model.
Definition at line 172 of file qgsmaplayerproxymodel.h.
|
inline |
Returns the blocklist of data providers which are excluded from the model.
Definition at line 200 of file qgsmaplayerproxymodel.h.
|
override |
Definition at line 175 of file qgsmaplayerproxymodel.cpp.
|
inline |
Returns the filter flags which affect how layers are filtered within the model.
Definition at line 91 of file qgsmaplayerproxymodel.h.
|
inline |
Returns the current filter string, if set.
Definition at line 208 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 156 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 144 of file qgsmaplayerproxymodel.h.
|
override |
Definition at line 189 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 115 of file qgsmaplayerproxymodel.cpp.
void QgsMapLayerProxyModel::setExceptedLayerList | ( | const QList< QgsMapLayer * > & | exceptList | ) |
Sets a blocklist of layers to exclude from the model.
Definition at line 101 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 140 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 169 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 92 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 87 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 110 of file qgsmaplayerproxymodel.cpp.
|
inline |
layerModel returns the QgsMapLayerModel used in this QSortFilterProxyModel
Definition at line 73 of file qgsmaplayerproxymodel.h.
|
readwrite |
Definition at line 34 of file qgsmaplayerproxymodel.h.
|
readwrite |
Definition at line 34 of file qgsmaplayerproxymodel.h.
|
readwrite |
Definition at line 34 of file qgsmaplayerproxymodel.h.