Class: QgsBrowserProxyModel¶
- class qgis.core.QgsBrowserProxyModel¶
Bases:
PyQt5.QtCore.QSortFilterProxyModel
A QSortFilterProxyModel subclass for filtering and sorting browser model items.
New in version 3.4.
QgsBrowserProxyModel(parent: QObject = None) Constructor for
QgsBrowserProxyModel
, with the specifiedparent
object.Methods
beginInsertColumns
beginInsertRows
beginMoveColumns
beginMoveRows
beginRemoveColumns
beginRemoveRows
Returns the underlying browser model.
Returns whether item filtering is case sensitive.
changePersistentIndex
createIndex
Returns the data item at the specified proxy
index
, orNone
if no item exists at the index.decodeData
- param sourceRow
Returns
True
if the model is filtered by map layer type.Returns the filter string used when filtering items in the model.
Returns the filter syntax.
- param parent
Returns the layer type to filter the model by.
lessThan
Sets the underlying browser
model
.Sets whether the model is filtered by map layer type.
Sets whether item filtering should be case sensitive.
Sets the
filter
string to use when filtering items in the model.Sets the filter
syntax
.Sets a filter to hide data items based on
QgsDataItem.providerKey()
associated with the item.Sets the layer
type
to filter the model by.Sets show layers to
showLayers
Sets a filter to show data items based on
QgsDataItem.providerKey()
associated with the item.Returns
True
if layers must be shown, this flag isTrue
by default.Attributes
- 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.
See also
- Return type
- caseSensitivity(self) Qt.CaseSensitivity ¶
Returns whether item filtering is case sensitive.
See also
- 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
, orNone
if no item exists at the index.- Parameters
index (QModelIndex) –
- Return type
- 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
See also
- Return type
bool
- filterString(self) str ¶
Returns the filter string used when filtering items in the model.
See also
- Return type
str
- filterSyntax(self) QgsBrowserProxyModel.FilterSyntax ¶
Returns the filter syntax.
See also
- Return type
- hasChildren(self, parent: QModelIndex = QModelIndex()) bool ¶
- Parameters
parent (QModelIndex = QModelIndex()) –
- Return type
bool
- invalidateFilter(self)¶
- isSignalConnected(self, QMetaMethod) bool ¶
- layerType(self) QgsMapLayerType ¶
Returns the layer type to filter the model by. This is only used if
filterByLayerType()
isTrue
.See also
See also
- Return type
- 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
- Parameters
model (QgsBrowserModel) –
- setFilterByLayerType(self, enabled: bool)¶
Sets whether the model is filtered by map layer type.
See also
See also
- Parameters
enabled (bool) –
- setFilterCaseSensitivity(self, sensitivity: Qt.CaseSensitivity)¶
Sets whether item filtering should be case sensitive.
See also
- Parameters
sensitivity (Qt.CaseSensitivity) –
- setFilterString(self, filter: str)¶
Sets the
filter
string to use when filtering items in the model.See also
- Parameters
filter (str) –
- setFilterSyntax(self, syntax: QgsBrowserProxyModel.FilterSyntax)¶
Sets the filter
syntax
.See also
- Parameters
syntax (QgsBrowserProxyModel.FilterSyntax) –
- setHiddenDataItemProviderKeyFilter(self, hiddenItemsFilter: Iterable[str])¶
Sets a filter to hide data items based on
QgsDataItem.providerKey()
associated with the item.By default browser model shows all items from all available data item providers and few special items (e.g. Favorites). To customize the behavior, 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:Favorites”, “special:Home”, “PostGIS”, “MSSQL”
All items created by the providers listed in filter are hidden from the layer tree. This filter is always evaluated.
- Parameters
hiddenItemsFilter (Iterable[str]) – a list of data provider prefixes that will be hidden.
New in version 3.12.
- setLayerType(self, type: QgsMapLayerType)¶
Sets the layer
type
to filter the model by. This is only used iffilterByLayerType()
isTrue
.See also
See also
- Parameters
type (QgsMapLayerType) –
- setShowLayers(self, showLayers: bool)¶
Sets show layers to
showLayers
See also
New in version 3.14.
- Parameters
showLayers (bool) –
- setShownDataItemProviderKeyFilter(self, shownItemsFilter: Iterable[str])¶
Sets a filter to show data items based on
QgsDataItem.providerKey()
associated with the item.By default browser model shows all items from all available data item providers and few special items (e.g. Favorites). To customize the behavior, set the filter to load only certain data items. The items that are not based on data item providers have prefix “special:”, for example “special:Favorites”, “special:Home”, “PostGIS”, “MSSQL”
Only the items created by the providers listed in filter are shown in the layer tree. This filter is always evaluated.
- Parameters
shownItemsFilter (Iterable[str]) – a list of data provider prefixes that will be hidden.
New in version 3.14.
- showLayers(self) bool ¶
Returns
True
if layers must be shown, this flag isTrue
by default.See also
New in version 3.14.
- Return type
bool
- timerEvent(self, QTimerEvent)¶