Class: QgsDataCollectionItem

A browser item for collections of data.

These represent logical collection of layers or subcollections, e.g. GRASS location/mapset, database? wms source?

Class Hierarchy

Inheritance diagram of qgis.core.QgsDataCollectionItem

Base classes

QgsDataItem

Base class for all items in the model.

QObject

Subclasses

QgsConnectionsRootItem

A browser item that represents a root group of connections from a single data provider.

QgsDatabaseSchemaItem

A browser item that represents a database schema item.

QgsDirectoryItem

A browser item for directories: contains subdirectories and layers.

QgsFavoritesItem

A browser item which contains various Favorites directories.

QgsZipItem

A browser item for zip (archive) files.

Methods

addChild

Static Methods

homeDirIcon

Shared home directory icon.

iconDataCollection

Returns the standard browser data collection icon.

iconDir

Returns the standard browser directory icon.

openDirIcon

Shared open directory icon.

class qgis.core.QgsDataCollectionItem[source]

Bases: QgsDataItem

__init__(parent: QgsDataItem | None, name: str | None, path: str | None = '', providerKey: str | None = '')

Constructor for QgsDataCollectionItem, with the specified parent item.

The name argument specifies the text to show in the model for the item. A translated string should be used wherever appropriate.

The path argument gives the item path in the browser tree. The path string can take any form, but QgsDataCollectionItem items pointing to different logical locations should always use a different item path.

The optional providerKey string can be used to specify the key for the QgsDataItemProvider that created this item.

Parameters:
  • parent (Optional[QgsDataItem])

  • name (Optional[str])

  • path (Optional[str] = '')

  • providerKey (Optional[str] = '')

addChild(self, item: QgsDataItem | None)[source]
Parameters:

item (Optional[QgsDataItem])

static homeDirIcon(fillColor: QColor | Qt.GlobalColor = QColor(), strokeColor: QColor | Qt.GlobalColor = QColor()) QIcon[source]

Shared home directory icon.

Since QGIS 3.20 the optional fillColor and strokeColor arguments can be used to specify a fill and stroke color for the icon.

Added in version 3.4.

Parameters:
  • fillColor (Union[QColor, Qt.GlobalColor] = QColor())

  • strokeColor (Union[QColor, Qt.GlobalColor] = QColor())

Return type:

QIcon

static iconDataCollection() QIcon[source]

Returns the standard browser data collection icon.

See also

iconDir()

Return type:

QIcon

static iconDir(fillColor: QColor | Qt.GlobalColor = QColor(), strokeColor: QColor | Qt.GlobalColor = QColor()) QIcon[source]

Returns the standard browser directory icon.

Since QGIS 3.20 the optional fillColor and strokeColor arguments can be used to specify a fill and stroke color for the icon.

Parameters:
  • fillColor (Union[QColor, Qt.GlobalColor] = QColor())

  • strokeColor (Union[QColor, Qt.GlobalColor] = QColor())

Return type:

QIcon

static openDirIcon(fillColor: QColor | Qt.GlobalColor = QColor(), strokeColor: QColor | Qt.GlobalColor = QColor()) QIcon[source]

Shared open directory icon.

Since QGIS 3.20 the optional fillColor and strokeColor arguments can be used to specify a fill and stroke color for the icon.

Added in version 3.4.

Parameters:
  • fillColor (Union[QColor, Qt.GlobalColor] = QColor())

  • strokeColor (Union[QColor, Qt.GlobalColor] = QColor())

Return type:

QIcon