16 #ifndef QGSMAPLAYERPROXYMODEL_H 17 #define QGSMAPLAYERPROXYMODEL_H 19 #include <QSortFilterProxyModel> 20 #include <QStringList> 22 #include "qgis_core.h" 37 Q_PROPERTY( QgsMapLayerProxyModel::Filters filters READ filters WRITE setFilters )
38 Q_PROPERTY( QList<
QgsMapLayer *> exceptedLayerList READ exceptedLayerList WRITE setExceptedLayerList )
39 Q_PROPERTY( QStringList exceptedLayerIds READ exceptedLayerIds WRITE setExceptedLayerIds )
49 HasGeometry = PointLayer | LineLayer | PolygonLayer,
50 VectorLayer = NoGeometry | HasGeometry,
54 All = RasterLayer | VectorLayer | PluginLayer | MeshLayer
56 Q_DECLARE_FLAGS( Filters,
Filter )
86 const Filters &
filters()
const {
return mFilters; }
99 void setLayerWhitelist(
const QList<QgsMapLayer *> &layers );
119 void setExceptedLayerList(
const QList<QgsMapLayer *> &exceptList );
134 void setExceptedLayerIds(
const QStringList &ids );
141 QStringList exceptedLayerIds()
const;
148 void setExcludedProviders(
const QStringList &providers );
165 bool filterAcceptsRow(
int source_row,
const QModelIndex &source_parent )
const override;
166 bool lessThan(
const QModelIndex &left,
const QModelIndex &right )
const override;
177 void setFilterString(
const QString &filter );
181 QList<QgsMapLayer *> mExceptList;
182 QList<QgsMapLayer *> mLayerWhitelist;
184 QStringList mExcludedProviders;
185 QString mFilterString;
188 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsMapLayerProxyModel::Filters )
190 #endif // QGSMAPLAYERPROXYMODEL_H Base class for all map layer types.
QList< QgsMapLayer * > exceptedLayerList()
Returns the blacklist of layers which are excluded from the model.
QStringList excludedProviders() const
Returns the blacklist of data providers which are excluded from the model.
QList< QgsMapLayer * > layerWhitelist()
Returns the list of layers which are excluded from the model.
The QgsMapLayerModel class is a model to display layers in widgets.
The QgsMapLayerProxyModel class provides an easy to use model to display the list of layers in widget...
QgsMapLayerModel * sourceLayerModel() const
layerModel returns the QgsMapLayerModel used in this QSortFilterProxyModel
QString filterString() const
Returns the current filter string, if set.
const Filters & filters() const
Returns the filter flags which affect how layers are filtered within the model.