QgsDataItemProviderFromPlugin class

Simple data item provider implementation that handles the support for provider plugins (which may contain dataCapabilities() and dataItem() functions).

Ideally the provider plugins should directly provide implementation of QgsDataItemProvider, for the time being this is a wrapper for the legacy interface.

Base classes

class QgsDataItemProvider
This is the interface for those who want to add custom data items to the browser tree.

Constructors, destructors, conversion operators

QgsDataItemProviderFromPlugin(const QString& name, dataCapabilities_t* capabilitiesFunc, dataItem_t* dataItemFunc, handlesDirectoryPath_t* handlesDirectoryPathFunc)
QgsDataItemProviderFromPlugin constructor.

Public functions

auto capabilities() -> int override
Returns combination of flags from QgsDataProvider::DataCapabilities.
auto createDataItem(const QString& path, QgsDataItem* parentItem) -> QgsDataItem* override
Create a new instance of QgsDataItem (or null) for given path and parent item.
auto handlesDirectoryPath(const QString& path) -> bool override
Returns true if the provider will handle the directory at the specified path.
auto name() -> QString override
Human-readable name of the provider name.

Function documentation

QgsDataItemProviderFromPlugin::QgsDataItemProviderFromPlugin(const QString& name, dataCapabilities_t* capabilitiesFunc, dataItem_t* dataItemFunc, handlesDirectoryPath_t* handlesDirectoryPathFunc)

QgsDataItemProviderFromPlugin constructor.

Parameters
name plugin name
capabilitiesFunc function pointer to the data capabilities
dataItemFunc function pointer to the data items
handlesDirectoryPathFunc function pointer to handlesDirectoryPath

QgsDataItem* QgsDataItemProviderFromPlugin::createDataItem(const QString& path, QgsDataItem* parentItem) override

Create a new instance of QgsDataItem (or null) for given path and parent item.

Caller takes responsibility of deleting created items.

bool QgsDataItemProviderFromPlugin::handlesDirectoryPath(const QString& path) override

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.