QGIS API Documentation
3.6.0-Noosa (5873452)
|
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, All = RasterLayer | VectorLayer | PluginLayer | MeshLayer } |
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... | |
QStringList | exceptedLayerIds () const |
Returns the blacklist of layer IDs which are excluded from the model. More... | |
QList< QgsMapLayer * > | exceptedLayerList () |
Returns the blacklist of layers which are excluded from the model. More... | |
QStringList | excludedProviders () const |
Returns the blacklist 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 * > | 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 blacklist of layers (by layer ID) to exclude from the model. More... | |
void | setExceptedLayerList (const QList< QgsMapLayer *> &exceptList) |
Sets a blacklist of layers to exclude from the model. More... | |
void | setExcludedProviders (const QStringList &providers) |
Sets a blacklist 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 | setLayerWhitelist (const QList< QgsMapLayer *> &layers) |
Sets a whitelist of layers to include within the model. More... | |
QgsMapLayerModel * | sourceLayerModel () const |
layerModel returns the QgsMapLayerModel used in this QSortFilterProxyModel 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.
Enumerator | |
---|---|
RasterLayer | |
NoGeometry | |
PointLayer | |
LineLayer | |
PolygonLayer | |
HasGeometry | |
VectorLayer | |
PluginLayer | |
WritableLayer | |
MeshLayer |
|
All |
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.
QStringList QgsMapLayerProxyModel::exceptedLayerIds | ( | ) | const |
Returns the blacklist of layer IDs which are excluded from the model.
|
inline |
Returns the blacklist of layers which are excluded from the model.
Definition at line 127 of file qgsmaplayerproxymodel.h.
|
inline |
Returns the blacklist of data providers which are excluded from the model.
Definition at line 155 of file qgsmaplayerproxymodel.h.
|
override |
Definition at line 99 of file qgsmaplayerproxymodel.cpp.
|
inline |
Returns the filter flags which affect how layers are filtered within the model.
Definition at line 86 of file qgsmaplayerproxymodel.h.
|
inline |
Returns the current filter string, if set.
Definition at line 163 of file qgsmaplayerproxymodel.h.
|
inline |
Returns the list of layers which are excluded from the model.
An empty list indicates that no whitelisting should be performed.
Definition at line 111 of file qgsmaplayerproxymodel.h.
|
override |
Definition at line 162 of file qgsmaplayerproxymodel.cpp.
void QgsMapLayerProxyModel::setExceptedLayerIds | ( | const QStringList & | ids | ) |
Sets a blacklist of layers (by layer ID) to exclude from the model.
Definition at line 64 of file qgsmaplayerproxymodel.cpp.
void QgsMapLayerProxyModel::setExceptedLayerList | ( | const QList< QgsMapLayer *> & | exceptList | ) |
Sets a blacklist of layers to exclude from the model.
Definition at line 55 of file qgsmaplayerproxymodel.cpp.
void QgsMapLayerProxyModel::setExcludedProviders | ( | const QStringList & | providers | ) |
Sets a blacklist of data providers which should be excluded from the model.
Definition at line 87 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 93 of file qgsmaplayerproxymodel.cpp.
void QgsMapLayerProxyModel::setLayerWhitelist | ( | const QList< QgsMapLayer *> & | layers | ) |
Sets a whitelist of layers to include within the model.
Only layers from this list will be shown.
An empty list indicates that no whitelisting should be performed.
Definition at line 46 of file qgsmaplayerproxymodel.cpp.
|
inline |
layerModel returns the QgsMapLayerModel used in this QSortFilterProxyModel
Definition at line 68 of file qgsmaplayerproxymodel.h.
|
readwrite |
Definition at line 39 of file qgsmaplayerproxymodel.h.
|
readwrite |
Definition at line 38 of file qgsmaplayerproxymodel.h.
|
readwrite |
Definition at line 37 of file qgsmaplayerproxymodel.h.