Class: QgsBrowserProxyModel

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

Bases: PyQt5.QtCore.QSortFilterProxyModel

Constructor for QgsBrowserProxyModel, with the specified parent object.

A QSortFilterProxyModel subclass for filtering and sorting browser model items.

New in version 3.4.

Parameters

parent

class FilterSyntax

Bases: int

Normal = 0
RegularExpression = 2
Wildcards = 1
QgsBrowserProxyModel.beginInsertColumns(self, QModelIndex, int, int)
QgsBrowserProxyModel.beginInsertRows(self, QModelIndex, int, int)
QgsBrowserProxyModel.beginMoveColumns(self, QModelIndex, int, int, QModelIndex, int) -> bool
QgsBrowserProxyModel.beginMoveRows(self, QModelIndex, int, int, QModelIndex, int) -> bool
QgsBrowserProxyModel.beginRemoveColumns(self, QModelIndex, int, int)
QgsBrowserProxyModel.beginRemoveRows(self, QModelIndex, int, int)
beginResetModel(self)
browserModel(self)QgsBrowserModel

Returns the underlying browser model.

Return type

QgsBrowserModel

caseSensitivity(self) → Qt.CaseSensitivity

Returns whether item filtering is case sensitive.

Return type

Qt.CaseSensitivity

QgsBrowserProxyModel.changePersistentIndex(self, QModelIndex, QModelIndex)
changePersistentIndexList(self, Iterable[QModelIndex], Iterable[QModelIndex])
childEvent(self, QChildEvent)
connectNotify(self, QMetaMethod)
QgsBrowserProxyModel.createIndex(self, int, int, object: object = 0) -> QModelIndex
customEvent(self, QEvent)
dataItem(self, index: QModelIndex)QgsDataItem

Returns the data item at the specified proxy index, or None if no item exists at the index.

Parameters

index (QModelIndex) –

Return type

QgsDataItem

QgsBrowserProxyModel.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)
filterAcceptsColumn(self, int, QModelIndex) → bool
filterAcceptsRow(self, sourceRow: int, sourceParent: QModelIndex) → bool
Parameters
  • sourceRow (int) –

  • sourceParent (QModelIndex) –

Return type

bool

filterByLayerType(self) → bool

Returns True if the model is filtered by map layer type.

See also

layerType()

Return type

bool

filterString(self) → str

Returns the filter string used when filtering items in the model.

Return type

str

filterSyntax(self) → QgsBrowserProxyModel.FilterSyntax

Returns the filter syntax.

Return type

QgsBrowserProxyModel.FilterSyntax

invalidateFilter(self)
isSignalConnected(self, QMetaMethod) → bool
layerType(self)QgsMapLayerType

Returns the layer type to filter the model by. This is only used if filterByLayerType() is True.

See also

setLayerType()

Return type

QgsMapLayerType

QgsBrowserProxyModel.lessThan(self, QModelIndex, QModelIndex) -> bool
persistentIndexList(self) → List[QModelIndex]
receivers(self, PYQT_SIGNAL) → int
resetInternalData(self)
sender(self) → QObject
senderSignalIndex(self) → int
setBrowserModel(self, model: QgsBrowserModel)

Sets the underlying browser model.

See also

browserModel()

Parameters

model (QgsBrowserModel) –

setDataItemProviderKeyFilter(self, filter: Iterable[str])

Sets the customization filters for data items based on item’s data provider key

By default browser model shows all items from all available data items provider and few special items (e.g. Favourites). To customize the behavious, set the filter to not load certain data items. The items that are not based on data item providers have prefix “special:”, for example “special:Favourites”, “special:Home”, “PostGIS”, “MSSQL”

All items created by the providers listed in filter are hidden from the layer tree. This filter is always evaluated.

New in version 3.12.

Parameters

filter (Iterable[str]) –

setFilterByLayerType(self, enabled: bool)

Sets whether the model is filtered by map layer type.

See also

setLayerType()

Parameters

enabled (bool) –

setFilterCaseSensitivity(self, sensitivity: Qt.CaseSensitivity)

Sets whether item filtering should be case sensitive.

Parameters

sensitivity (Qt.CaseSensitivity) –

setFilterString(self, filter: str)

Sets the filter string to use when filtering items in the model.

See also

filterString()

Parameters

filter (str) –

setFilterSyntax(self, syntax: QgsBrowserProxyModel.FilterSyntax)

Sets the filter syntax.

See also

filterSyntax()

Parameters

syntax (QgsBrowserProxyModel.FilterSyntax) –

setLayerType(self, type: QgsMapLayerType)

Sets the layer type to filter the model by. This is only used if filterByLayerType() is True.

See also

layerType()

Parameters

type (QgsMapLayerType) –

timerEvent(self, QTimerEvent)