Class: QgsFavoritesItem¶
- class qgis.core.QgsFavoritesItem¶
Bases:
QgsDataCollectionItem
Contains various Favorites directories
QgsFavoritesItem(parent:
QgsDataItem
, name: str, path: str = ‘’) Constructor forQgsFavoritesItem
. Accepts a path argument specifying the file path associated with the item.Methods
Adds a new
directory
to the favorites group.- rtype:
List[QgsDataItem]
The item is scheduled to be deleted.
Shared home directory icon.
Icon for favorites group
Shared open directory icon.
Refresh the items from a specified list of child items.
Removes an existing directory from the favorites group.
Renames the stored favorite with corresponding
path
a newname
.- rtype:
Any
Will request a repaint of this icon.
- 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 matchdirectory
.See also
- Parameters:
directory (str) –
name (str = '') –
- childEvent(self, QChildEvent)¶
- connectNotify(self, QMetaMethod)¶
- createChildren(self) List[QgsDataItem] ¶
- Return type:
List[QgsDataItem]
- 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), thedeferredDelete()
returnsTrue
and item will be deleted once Populating finished. Items with slowreateChildren()
(for example network or database based) may check duringcreateChildren()
ifdeferredDelete()
returnsTrue
and return fromcreateChildren()
immediately because result will be useless.
- disconnectNotify(self, QMetaMethod)¶
- homeDirIcon(fillColor: QColor | Qt.GlobalColor | QGradient = QColor(), strokeColor: QColor | Qt.GlobalColor | QGradient = QColor()) QIcon ¶
Shared home directory icon.
Since QGIS 3.20 the optional
fillColor
andstrokeColor
arguments can be used to specify a fill and stroke color for the icon.New in version 3.4.
- iconFavorites() QIcon ¶
Icon for favorites group
- Return type:
QIcon
- isSignalConnected(self, QMetaMethod) bool ¶
- openDirIcon(fillColor: QColor | Qt.GlobalColor | QGradient = QColor(), strokeColor: QColor | Qt.GlobalColor | QGradient = QColor()) QIcon ¶
Shared open directory icon.
Since QGIS 3.20 the optional
fillColor
andstrokeColor
arguments can be used to specify a fill and stroke color for the icon.New in version 3.4.
- populate(self, children: Iterable[QgsDataItem])¶
- populate(self, foreground: bool = False) None
- receivers(self, PYQT_SIGNAL) int ¶
- refresh(self, children: Iterable[QgsDataItem])¶
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
- Parameters:
item (QgsDirectoryItem) –
- renameFavorite(self, path: str, name: str)¶
Renames the stored favorite with corresponding
path
a newname
.- 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.