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,
59 Q_DECLARE_FLAGS( Filters, Filter )
89 const Filters &
filters()
const {
return mFilters; }
95 static bool layerMatchesFilters(
const QgsMapLayer *layer,
const Filters &filters );
108 Q_DECL_DEPRECATED
void setLayerWhitelist(
const QList<QgsMapLayer *> &layers )
SIP_DEPRECATED;
121 void setLayerAllowlist(
const QList<QgsMapLayer *> &layers );
153 void setExceptedLayerList(
const QList<QgsMapLayer *> &exceptList );
168 void setExceptedLayerIds(
const QStringList &ids );
175 QStringList exceptedLayerIds()
const;
182 void setExcludedProviders(
const QStringList &providers );
206 bool filterAcceptsRow(
int source_row,
const QModelIndex &source_parent )
const override;
207 bool lessThan(
const QModelIndex &left,
const QModelIndex &right )
const override;
218 void setFilterString(
const QString &filter );
222 QList<QgsMapLayer *> mExceptList;
223 QList<QgsMapLayer *> mLayerAllowlist;
225 QStringList mExcludedProviders;
226 QString mFilterString;
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...
Q_DECL_DEPRECATED QList< QgsMapLayer * > layerWhitelist()
Returns the list of layers which are excluded from the model.
QgsMapLayerModel * sourceLayerModel() const
layerModel returns the QgsMapLayerModel used in this QSortFilterProxyModel
QList< QgsMapLayer * > layerAllowlist()
Returns the list of layers which are excluded from the model.
const Filters & filters() const
Returns the filter flags which affect how layers are filtered within 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.
QString filterString() const
Returns the current filter string, if set.
Base class for all map layer types.
@ PointCloudLayer
Added in 3.18.
@ VectorTileLayer
Added in 3.14.
@ AnnotationLayer
Contains freeform, georeferenced annotations. Added in QGIS 3.16.
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.