Class: QgsProviderSublayerModel¶
- class qgis.core.QgsProviderSublayerModel¶
Bases:
PyQt5.QtCore.QAbstractItemModel
A model for representing the sublayers present in a URI.
QgsProviderSublayerModel
is designed to present a tree view of the sublayers available for a URI, including any vector, raster or mesh sublayers present.Additionally,
QgsProviderSublayerModel
can include some non-sublayer items, e.g. in order to represent other content available for a URI, such as embedded project items. The non-sublayer items can be added by callingaddNonLayerItem()
.Added in version 3.22.
QgsProviderSublayerModel(parent: Optional[QObject] = None) Constructor for
QgsProviderSublayerModel
, with the specifiedparent
object.Enums
Bases:
enum.IntEnum
Bases:
enum.IntEnum
Methods
Adds a non-layer item (e.g. an embedded QGIS project item) to the model.
- param parent:
- param index:
- param index:
- param section:
- param row:
Returns the non layer item corresponding to the given
index
.Returns the sublayer corresponding to the given
index
.- param index:
- param parent:
Sets the sublayer
details
to show in the model.Returns the sublayer details shown in the model.
- class Column(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
enum.IntEnum
Model columns
Name
: Layer nameDescription
: Layer description
- Description = 1¶
- Name = 0¶
- class NonLayerItem¶
Bases:
sip.wrapper
Contains details for a non-sublayer item to include in a QgsProviderSublayerModel.
Added in version 3.22.
- description(self) str ¶
Returns the item’s description.
See also
- Return type:
str
- setDescription(self, description: str | None)¶
Sets the item’s
description
.See also
- Parameters:
description (Optional[str])
- setName(self, name: str | None)¶
Sets the item’s
name
.See also
- Parameters:
name (Optional[str])
- setType(self, type: str | None)¶
Sets the item’s
type
.See also
- Parameters:
type (Optional[str])
- setUri(self, uri: str | None)¶
Set the item’s
uri
.See also
- Parameters:
uri (Optional[str])
- class Role(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
enum.IntEnum
Custom model roles
ProviderKey
: Provider keyLayerType
: Layer typeUri
: Layer URIName
: Layer nameDescription
: Layer descriptionPath
: Layer pathFeatureCount
: Feature count (for vector sublayers)WkbType
: WKB geometry type (for vector sublayers)GeometryColumnName
: Geometry column name (for vector sublayers)LayerNumber
: Layer numberIsNonLayerItem
:True
if item is a non-sublayer item (e.g. an embedded project)NonLayerItemType
: Item type (for non-sublayer items)Flags
: Sublayer flags
- Description = 261¶
- FeatureCount = 263¶
- Flags = 269¶
- GeometryColumnName = 265¶
- IsNonLayerItem = 267¶
- LayerNumber = 266¶
- LayerType = 258¶
- Name = 260¶
- NonLayerItemType = 268¶
- Path = 262¶
- ProviderKey = 257¶
- Uri = 259¶
- WkbType = 264¶
- addNonLayerItem(self, item: QgsProviderSublayerModel.NonLayerItem)¶
Adds a non-layer item (e.g. an embedded QGIS project item) to the model.
- Parameters:
- beginInsertColumns(self, parent: QModelIndex, first: int, last: int)¶
- beginInsertRows(self, parent: QModelIndex, first: int, last: int)¶
- beginMoveColumns(self, sourceParent: QModelIndex, sourceFirst: int, sourceLast: int, destinationParent: QModelIndex, destinationColumn: int) bool ¶
- beginMoveRows(self, sourceParent: QModelIndex, sourceFirst: int, sourceLast: int, destinationParent: QModelIndex, destinationRow: int) bool ¶
- beginRemoveColumns(self, parent: QModelIndex, first: int, last: int)¶
- beginRemoveRows(self, parent: QModelIndex, first: int, last: int)¶
- beginResetModel(self)¶
- changePersistentIndex(self, from_: QModelIndex, to: QModelIndex)¶
- changePersistentIndexList(self, from_: Iterable[QModelIndex], to: Iterable[QModelIndex])¶
- childEvent(self, a0: QChildEvent | None)¶
- columnCount(self, parent: QModelIndex = QModelIndex()) int ¶
- Parameters:
parent (QModelIndex = QModelIndex())
- Return type:
int
- connectNotify(self, signal: QMetaMethod)¶
- createIndex(self, row: int, column: int, object: Any = None) QModelIndex ¶
- customEvent(self, a0: QEvent | None)¶
- data(self, index: QModelIndex, role: int) Any ¶
- Parameters:
index (QModelIndex)
role (int)
- Return type:
Any
- decodeData(self, row: int, column: int, parent: QModelIndex, stream: QDataStream) bool ¶
- disconnectNotify(self, signal: QMetaMethod)¶
- encodeData(self, indexes: Iterable[QModelIndex], stream: QDataStream)¶
- endInsertColumns(self)¶
- endInsertRows(self)¶
- endMoveColumns(self)¶
- endMoveRows(self)¶
- endRemoveColumns(self)¶
- endRemoveRows(self)¶
- endResetModel(self)¶
- flags(self, index: QModelIndex) Qt.ItemFlags ¶
- Parameters:
index (QModelIndex)
- Return type:
Qt.ItemFlags
- headerData(self, section: int, orientation: Qt.Orientation, role: int = Qt.DisplayRole) Any ¶
- Parameters:
section (int)
orientation (Qt.Orientation)
role (int = Qt.DisplayRole)
- Return type:
Any
- index(self, row: int, column: int, parent: QModelIndex = QModelIndex()) QModelIndex ¶
- Parameters:
row (int)
column (int)
parent (QModelIndex = QModelIndex())
- Return type:
QModelIndex
- indexToNonLayerItem(self, index: QModelIndex) QgsProviderSublayerModel.NonLayerItem ¶
Returns the non layer item corresponding to the given
index
.- Parameters:
index (QModelIndex)
- Return type:
- indexToSublayer(self, index: QModelIndex) QgsProviderSublayerDetails ¶
Returns the sublayer corresponding to the given
index
.- Parameters:
index (QModelIndex)
- Return type:
- isSignalConnected(self, signal: QMetaMethod) bool ¶
- parent(self, index: QModelIndex) QModelIndex ¶
- Parameters:
index (QModelIndex)
- Return type:
QModelIndex
- persistentIndexList(self) List[QModelIndex] ¶
- receivers(self, signal: PYQT_SIGNAL) int ¶
- resetInternalData(self)¶
- rowCount(self, parent: QModelIndex) int ¶
- Parameters:
parent (QModelIndex)
- Return type:
int
- sender(self) QObject | None ¶
- senderSignalIndex(self) int ¶
- setSublayerDetails(self, details: Iterable[QgsProviderSublayerDetails])¶
Sets the sublayer
details
to show in the model.See also
- Parameters:
details (Iterable[QgsProviderSublayerDetails])
- sublayerDetails(self) List[QgsProviderSublayerDetails] ¶
Returns the sublayer details shown in the model.
See also
- Return type:
- timerEvent(self, a0: QTimerEvent | None)¶