Class: QgsMapLayerProxyModel

class qgis.core.QgsMapLayerProxyModel(parent: QObject = None)

Bases: PyQt5.QtCore.QSortFilterProxyModel

QgsMapLayerProxModel creates a proxy model with a QgsMapLayerModel as source model. It can be used to filter the layers list in a widget.

The QgsMapLayerProxyModel class provides an easy to use model to display the list of layers in widgets.

New in version 2.3: Enums

Methods

beginInsertColumns

beginInsertRows

beginMoveColumns

beginMoveRows

beginRemoveColumns

beginRemoveRows

beginResetModel

changePersistentIndex

changePersistentIndexList

childEvent

connectNotify

createIndex

customEvent

decodeData

disconnectNotify

encodeData

endInsertColumns

endInsertRows

endMoveColumns

endMoveRows

endRemoveColumns

endRemoveRows

endResetModel

exceptedLayerIds

Returns the blacklist of layer IDs which are excluded from the model.

exceptedLayerList

Returns the blacklist of layers which are excluded from the model.

excludedProviders

Returns the blacklist of data providers which are excluded from the model.

filterAcceptsColumn

filterAcceptsRow

filterString

Returns the current filter string, if set.

filters

Returns the filter flags which affect how layers are filtered within the model.

invalidateFilter

isSignalConnected

layerWhitelist

Returns the list of layers which are excluded from the model.

lessThan

persistentIndexList

receivers

resetInternalData

sender

senderSignalIndex

setExceptedLayerIds

Sets a blacklist of layers (by layer ID) to exclude from the model.

setExceptedLayerList

Sets a blacklist of layers to exclude from the model.

setExcludedProviders

Sets a blacklist of data providers which should be excluded from the model.

setFilterString

Sets a filter string, such that only layers with names matching the specified string will be shown.

setFilters

Sets filter flags which affect how layers are filtered within the model.

setLayerWhitelist

Sets a whitelist of layers to include within the model.

sourceLayerModel

layerModel returns the QgsMapLayerModel used in this QSortFilterProxyModel

timerEvent

Signals

Attributes

All

HasGeometry

LineLayer

NoGeometry

PluginLayer

PointLayer

PolygonLayer

RasterLayer

VectorLayer

WritableLayer

All = 63
class Filter

Bases: int

class Filters

Bases: sip.wrapper

QgsMapLayerProxyModel.Filters(Union[QgsMapLayerProxyModel.Filters, QgsMapLayerProxyModel.Filter]) QgsMapLayerProxyModel.Filters(QgsMapLayerProxyModel.Filters)

baseClass

alias of QgsMapLayerProxyModel

HasGeometry = 28
LineLayer = 8
NoGeometry = 2
PluginLayer = 32
PointLayer = 4
PolygonLayer = 16
RasterLayer = 1
VectorLayer = 30
WritableLayer = 64
beginInsertColumns()
beginInsertRows()
beginMoveColumns()
beginMoveRows()
beginRemoveColumns()
beginRemoveRows()
beginResetModel()
changePersistentIndex()
changePersistentIndexList()
childEvent()
connectNotify()
createIndex()
customEvent()
decodeData()
disconnectNotify()
encodeData()
endInsertColumns()
endInsertRows()
endMoveColumns()
endMoveRows()
endRemoveColumns()
endRemoveRows()
endResetModel()
exceptedLayerIds(self) → List[str]

Returns the blacklist of layer IDs which are excluded from the model.

exceptedLayerList(self) → List[QgsMapLayer]

Returns the blacklist of layers which are excluded from the model.

See also

layerWhitelist()

excludedProviders(self) → List[str]

Returns the blacklist of data providers which are excluded from the model.

New in version 3.0.

filterAcceptsColumn()
filterAcceptsRow(self, source_row: int, source_parent: QModelIndex) → bool
filterString(self) → str

Returns the current filter string, if set.

New in version 3.4.

filters(self) → QgsMapLayerProxyModel.Filters

Returns the filter flags which affect how layers are filtered within the model.

See also

setFilters()

New in version 2.3.

invalidateFilter()
isSignalConnected()
layerWhitelist(self) → List[QgsMapLayer]

Returns the list of layers which are excluded from the model.

An empty list indicates that no whitelisting should be performed.

New in version 3.4.

lessThan(self, left: QModelIndex, right: QModelIndex) → bool
persistentIndexList()
receivers()
resetInternalData()
sender()
senderSignalIndex()
setExceptedLayerIds(self, ids: Iterable[str])

Sets a blacklist of layers (by layer ID) to exclude from the model.

setExceptedLayerList(self, exceptList: Iterable[QgsMapLayer])

Sets a blacklist of layers to exclude from the model.

setExcludedProviders(self, providers: Iterable[str])

Sets a blacklist of data providers which should be excluded from the model.

New in version 3.0.

setFilterString(self, filter: str)

Sets a filter string, such that only layers with names matching the specified string will be shown.

See also

filterString()

New in version 3.4.

setFilters(self, filters: Union[QgsMapLayerProxyModel.Filters, QgsMapLayerProxyModel.Filter]) → QgsMapLayerProxyModel

Sets filter flags which affect how layers are filtered within the model.

See also

filters()

New in version 2.3.

setLayerWhitelist(self, layers: Iterable[QgsMapLayer])

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.

See also

layerWhitelist()

New in version 3.4.

sourceLayerModel(self) → QgsMapLayerModel

layerModel returns the QgsMapLayerModel used in this QSortFilterProxyModel

timerEvent()