Subgroup: Data

Class: QgsDataItemProvider

class qgis.core.QgsDataItemProvider

Bases: sip.wrapper

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

The method createDataItem() is ever called only if capabilities() return non-zero value. There are two occasions when createDataItem() is called: 1. to create root items (passed path is empty, parent item is null). 2. 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

New in version 2.10: Methods

capabilities Returns combination of flags from QgsDataProvider.DataCapabilities
createDataItem Create a new instance of QgsDataItem (or null) for given path and parent item.
createDataItems Create a vector of instances of QgsDataItem (or null) for given path and parent item.
handlesDirectoryPath Returns true if the provider will handle the directory at the specified path.
name Human-readable name of the provider name

Signals

Attributes

capabilities(self) → int

Returns combination of flags from QgsDataProvider.DataCapabilities

createDataItem(self, path: str, parentItem: QgsDataItem) → QgsDataItem

Create a new instance of QgsDataItem (or null) for given path and parent item. Caller takes responsibility of deleting created items.

createDataItems(self, path: str, parentItem: QgsDataItem) → object

Create a vector of instances of QgsDataItem (or null) for given path and parent item. Caller takes responsibility of deleting created items.

handlesDirectoryPath(self, path: str) → bool

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.

New in version 3.0.

name(self) → str

Human-readable name of the provider name