Class: QgsFavoritesItem

class qgis.core.QgsFavoritesItem(parent: QgsDataItem, name: str, path: str = '')

Bases: QgsDataCollectionItem

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

Contains various Favorites directories

New in version 3.0.

Parameters
addDirectory(self, directory: str, name: str = '')

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 (str) –

  • name (str = '') –

childEvent(self, QChildEvent)
connectNotify(self, QMetaMethod)
createChildren(self) → object
Return type

object

customEvent(self, QEvent)
deferredDelete(self) → bool

The item is scheduled to be deleted. E.g. if deleteLater() is called when item is in Populating state (createChildren() running in another thread), the deferredDelete() returns True and item will be deleted once Populating finished. Items with slow reateChildren() (for example network or database based) may check during createChildren() if deferredDelete() returns True and return from createChildren() immediately because result will be useless.

disconnectNotify(self, QMetaMethod)
homeDirIcon() → QIcon

Shared home directory icon.

New in version 3.4.

iconFavorites() → QIcon

Icon for favorites group

Return type

QIcon

isSignalConnected(self, QMetaMethod) → bool
openDirIcon() → QIcon

Shared open directory icon.

New in version 3.4.

populate(self, children: object)

populate(self, foreground: bool = False)

receivers(self, PYQT_SIGNAL) → int
refresh(self, children: object)

Refresh the items from a specified list of child items.

refresh(self)

removeDirectory(self, item: QgsDirectoryItem)

Removes an existing directory from the favorites group.

See also

addDirectory()

Parameters

item (QgsDirectoryItem) –

renameFavorite(self, path: str, name: str)

Renames the stored favorite with corresponding path a new name.

Parameters
  • path (str) –

  • name (str) –

sender(self) → QObject
senderSignalIndex(self) → int
sortKey(self) → Any
Return type

Any

timerEvent(self, QTimerEvent)
updateIcon(self)

Will request a repaint of this icon.

New in version 3.0.