QgsDataItemProvider class
This is the interface for those who want to add custom data items to the browser tree.
Contents
- Reference
The method createDataItem() is ever called only if capabilities() return non-zero value. There are two occasions when createDataItem() is called:
- to create root items (passed path is empty, parent item is null).
- to create items in directory structure. For this capabilities have to return at least of the following: QgsDataProvider::
Dir or QgsDataProvider:: File. Passed path is the file or directory being inspected, parent item is a valid QgsDirectoryItem
Derived classes
- class QgsDataItemProviderFromPlugin
- Simple data item provider implementation that handles the support for provider plugins (which may contain dataCapabilities() and dataItem() functions).
Public functions
- auto capabilities() -> int pure virtual
- Returns combination of flags from QgsDataProvider::DataCapabilities.
- auto createDataItem(const QString& path, QgsDataItem* parentItem) -> QgsDataItem* pure virtual
- Create a new instance of QgsDataItem (or null) for given path and parent item.
- auto createDataItems(const QString& path, QgsDataItem* parentItem) -> QVector<QgsDataItem*> virtual
- Create a vector of instances of QgsDataItem (or null) for given path and parent item.
- auto handlesDirectoryPath(const QString& path) -> bool virtual
- Returns true if the provider will handle the directory at the specified path.
- auto name() -> QString pure virtual
- Human-readable name of the provider name.
Function documentation
QgsDataItem* QgsDataItemProvider:: createDataItem(const QString& path,
QgsDataItem* parentItem) pure virtual
Create a new instance of QgsDataItem (or null) for given path and parent item.
Caller takes responsibility of deleting created items.
QVector<QgsDataItem*> QgsDataItemProvider:: createDataItems(const QString& path,
QgsDataItem* parentItem) virtual
Create a vector of instances of QgsDataItem (or null) for given path and parent item.
Caller takes responsibility of deleting created items.
bool QgsDataItemProvider:: handlesDirectoryPath(const QString& path) virtual
Returns true if the provider will handle the directory at the specified path.
If the provider indicates that it will handle the directory, the default creation and population of directory items for the path will be avoided and it is left to the provider to correctly populate relevant entries for the path.
The default implementation returns false for all paths.