Class: QgsFavoritesItem

A browser item which contains various Favorites directories.

Class Hierarchy

Inheritance diagram of qgis.core.QgsFavoritesItem

Base classes

QgsDataCollectionItem

A browser item for collections of data.

QgsDataItem

Base class for all items in the model.

QObject

Methods

addDirectory

Adds a new directory to the favorites group.

removeDirectory

Removes an existing directory from the favorites group.

renameFavorite

Renames the stored favorite with corresponding path a new name.

Static Methods

iconFavorites

Icon for favorites group

class qgis.core.QgsFavoritesItem[source]

Bases: QgsDataCollectionItem

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

Constructor for QgsFavoritesItem. Accepts a path argument specifying the file path associated with the item.

Parameters:
  • parent (Optional[QgsDataItem])

  • name (Optional[str])

  • path (Optional[str] = '')

addDirectory(self, directory: str | None, name: str | None = '')[source]

Adds a new directory to the favorites group.

If name is specified, it will be used as the favorite’s name. Otherwise the name will be set to match directory.

Parameters:
  • directory (Optional[str])

  • name (Optional[str] = '')

static iconFavorites() QIcon[source]

Icon for favorites group

Return type:

QIcon

removeDirectory(self, item: QgsDirectoryItem | None)[source]

Removes an existing directory from the favorites group.

See also

addDirectory()

Parameters:

item (Optional[QgsDirectoryItem])

renameFavorite(self, path: str | None, name: str | None)[source]

Renames the stored favorite with corresponding path a new name.

Parameters:
  • path (Optional[str])

  • name (Optional[str])