QgsFavoritesItem class
Contains various Favorites directories.
Contents
Base classes
- class QgsDataCollectionItem
- A Collection: logical collection of layers or subcollections, e.g.
Public static functions
- static auto iconFavorites() -> QIcon
- Icon for favorites group.
Constructors, destructors, conversion operators
- QgsFavoritesItem(QgsDataItem* parent, const QString& name, const QString& path = QString())
- Constructor for QgsFavoritesItem.
Public functions
- void addDirectory(const QString& directory, const QString& name = QString())
- Adds a new directory to the favorites group.
- auto createChildren() -> QVector<QgsDataItem*> override
- Create children.
- void removeDirectory(QgsDirectoryItem* item)
- Removes an existing directory from the favorites group.
- void renameFavorite(const QString& path, const QString& name)
- Renames the stored favorite with corresponding path a new name.
- auto sortKey() const -> QVariant override
- Returns the sorting key for the item.
Function documentation
QgsFavoritesItem:: QgsFavoritesItem(QgsDataItem* parent,
const QString& name,
const QString& path = QString())
Constructor for QgsFavoritesItem.
Accepts a path argument specifying the file path associated with the item.
void QgsFavoritesItem:: addDirectory(const QString& directory,
const QString& name = QString())
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.
QVector<QgsDataItem*> QgsFavoritesItem:: createChildren() override
Create children.
Children are not expected to have parent set. This method MUST BE THREAD SAFE.
void QgsFavoritesItem:: removeDirectory(QgsDirectoryItem* item)
Removes an existing directory from the favorites group.
QVariant QgsFavoritesItem:: sortKey() const override
Returns the sorting key for the item.
By default name() is returned, but setSortKey() can be used to set a custom sort key for the item.
Alternatively subclasses can override this method to return a custom sort key.