Class: QgsMapLayerProxyModel¶
- class qgis.core.QgsMapLayerProxyModel¶
Bases:
PyQt5.QtCore.QSortFilterProxyModel
The
QgsMapLayerProxyModel
class provides an easy to use model to display the list of layers in widgets.New in version 2.3.
QgsMapLayerProxyModel(parent: QObject = None)
QgsMapLayerProxModel
creates a proxy model with aQgsMapLayerModel
as source model. It can be used to filter the layers list in a widget.Methods
Returns
True
if the proxy model accepts the specified maplayer
.beginInsertColumns
beginInsertRows
beginMoveColumns
beginMoveRows
beginRemoveColumns
beginRemoveRows
changePersistentIndex
createIndex
decodeData
Returns the blocklist of layer IDs which are excluded from the model.
Returns the blocklist of layers which are excluded from the model.
Returns the blocklist of data providers which are excluded from the model.
- param source_row
Returns the current filter string, if set.
Returns the filter flags which affect how layers are filtered within the model.
Returns the list of layers which are excluded from the model.
Returns if the
layer
matches the givenfilters
Returns the list of layers which are excluded from the model.
- param left
Sets a blocklist of layers (by layer ID) to exclude from the model.
Sets a blocklist of layers to exclude from the model.
Sets a blocklist of data providers which should be excluded from the model.
Sets a
filter
string, such that only layers with names matching the specified string will be shown.Sets
filter
flags which affect how layers are filtered within the model.Sets an allowlist of
layers
to include within the model.Sets an allowlist of
layers
to include within the model.Sets the
project
from which map layers are shown.layerModel returns the
QgsMapLayerModel
used in this QSortFilterProxyModelAttributes
- All = 1983¶
- AnnotationLayer = 1024¶
- class Filter¶
Bases:
int
- class Filters¶
- class Filters(Union[QgsMapLayerProxyModel.Filters, QgsMapLayerProxyModel.Filter])
- class Filters(QgsMapLayerProxyModel.Filters)
Bases:
sip.wrapper
- baseClass¶
alias of
QgsMapLayerProxyModel
- HasGeometry = 28¶
- LineLayer = 8¶
- MeshLayer = 128¶
- NoGeometry = 2¶
- PluginLayer = 32¶
- PointCloudLayer = 512¶
- PointLayer = 4¶
- PolygonLayer = 16¶
- RasterLayer = 1¶
- SpatialLayer = 1981¶
- VectorLayer = 30¶
- VectorTileLayer = 256¶
- WritableLayer = 64¶
- acceptsLayer(self, layer: QgsMapLayer) bool ¶
Returns
True
if the proxy model accepts the specified maplayer
.New in version 3.8.
- Parameters
layer (QgsMapLayer) –
- Return type
bool
- QgsMapLayerProxyModel.beginInsertColumns(self, QModelIndex, int, int)
- QgsMapLayerProxyModel.beginInsertRows(self, QModelIndex, int, int)
- QgsMapLayerProxyModel.beginMoveColumns(self, QModelIndex, int, int, QModelIndex, int) -> bool
- QgsMapLayerProxyModel.beginMoveRows(self, QModelIndex, int, int, QModelIndex, int) -> bool
- QgsMapLayerProxyModel.beginRemoveColumns(self, QModelIndex, int, int)
- QgsMapLayerProxyModel.beginRemoveRows(self, QModelIndex, int, int)
- beginResetModel(self)¶
- QgsMapLayerProxyModel.changePersistentIndex(self, QModelIndex, QModelIndex)
- changePersistentIndexList(self, Iterable[QModelIndex], Iterable[QModelIndex])¶
- childEvent(self, QChildEvent)¶
- connectNotify(self, QMetaMethod)¶
- QgsMapLayerProxyModel.createIndex(self, int, int, object: object = 0) -> QModelIndex
- customEvent(self, QEvent)¶
- QgsMapLayerProxyModel.decodeData(self, int, int, QModelIndex, QDataStream) -> bool
- disconnectNotify(self, QMetaMethod)¶
- encodeData(self, Iterable[QModelIndex], QDataStream)¶
- endInsertColumns(self)¶
- endInsertRows(self)¶
- endMoveColumns(self)¶
- endMoveRows(self)¶
- endRemoveColumns(self)¶
- endRemoveRows(self)¶
- endResetModel(self)¶
- exceptedLayerIds(self) List[str] ¶
Returns the blocklist of layer IDs which are excluded from the model.
See also
See also
- Return type
List[str]
- exceptedLayerList(self) List[QgsMapLayer] ¶
Returns the blocklist of layers which are excluded from the model.
See also
See also
See also
- Return type
List[QgsMapLayer]
- excludedProviders(self) List[str] ¶
Returns the blocklist of data providers which are excluded from the model.
See also
New in version 3.0.
- Return type
List[str]
- filterAcceptsColumn(self, int, QModelIndex) bool ¶
- filterAcceptsRow(self, source_row: int, source_parent: QModelIndex) bool ¶
- Parameters
source_row (int) –
source_parent (QModelIndex) –
- Return type
bool
- filterString(self) str ¶
Returns the current filter string, if set.
See also
New in version 3.4.
- Return type
str
- filters(self) QgsMapLayerProxyModel.Filters ¶
Returns the filter flags which affect how layers are filtered within the model.
See also
New in version 2.3.
- Return type
- invalidateFilter(self)¶
- isSignalConnected(self, QMetaMethod) bool ¶
- layerAllowlist(self) List[QgsMapLayer] ¶
Returns the list of layers which are excluded from the model.
An empty list indicates that no filtering by allowlist should be performed.
See also
See also
New in version 3.14.
- Return type
List[QgsMapLayer]
- layerMatchesFilters(layer: QgsMapLayer, filters: Union[QgsMapLayerProxyModel.Filters, QgsMapLayerProxyModel.Filter]) bool ¶
Returns if the
layer
matches the givenfilters
New in version 3.14.
- Parameters
layer (QgsMapLayer) –
filters (Union[QgsMapLayerProxyModel.Filters) –
- Return type
bool
- layerWhitelist(self) List[QgsMapLayer] ¶
Returns the list of layers which are excluded from the model.
An empty list indicates that no filtering by allowlist should be performed.
See also
See also
Deprecated since version use:
layerAllowlist()
instead- Return type
List[QgsMapLayer]
- lessThan(self, left: QModelIndex, right: QModelIndex) bool ¶
- Parameters
left (QModelIndex) –
right (QModelIndex) –
- Return type
bool
- persistentIndexList(self) List[QModelIndex] ¶
- receivers(self, PYQT_SIGNAL) int ¶
- resetInternalData(self)¶
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setExceptedLayerIds(self, ids: Iterable[str])¶
Sets a blocklist of layers (by layer ID) to exclude from the model.
See also
See also
- Parameters
ids (Iterable[str]) –
- setExceptedLayerList(self, exceptList: Iterable[QgsMapLayer])¶
Sets a blocklist of layers to exclude from the model.
See also
See also
See also
- Parameters
exceptList (Iterable[QgsMapLayer]) –
- setExcludedProviders(self, providers: Iterable[str])¶
Sets a blocklist of data providers which should be excluded from the model.
See also
New in version 3.0.
- Parameters
providers (Iterable[str]) –
- setFilterString(self, filter: str)¶
Sets a
filter
string, such that only layers with names matching the specified string will be shown.See also
New in version 3.4.
- Parameters
filter (str) –
- setFilters(self, filters: Union[QgsMapLayerProxyModel.Filters, QgsMapLayerProxyModel.Filter]) QgsMapLayerProxyModel ¶
Sets
filter
flags which affect how layers are filtered within the model.See also
New in version 2.3.
- Parameters
filters (Union[QgsMapLayerProxyModel.Filters) –
- Return type
- setLayerAllowlist(self, layers: Iterable[QgsMapLayer])¶
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.
See also
See also
New in version 3.14.
- Parameters
layers (Iterable[QgsMapLayer]) –
- setLayerWhitelist(self, layers: Iterable[QgsMapLayer])¶
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.
See also
See also
Deprecated since version use:
setLayerAllowList()
- Parameters
layers (Iterable[QgsMapLayer]) –
- setProject(self, project: QgsProject)¶
Sets the
project
from which map layers are shown.If
project
isNone
thenQgsProject.instance()
will be used.New in version 3.24.
- Parameters
project (QgsProject) –
- sourceLayerModel(self) QgsMapLayerModel ¶
layerModel returns the
QgsMapLayerModel
used in this QSortFilterProxyModel- Return type
- timerEvent(self, QTimerEvent)¶